
** Games data treatment **

use "$Endline_dtRaw/games/games_export_data6.dta", clear

label drop _all

sort school_id

rename data_dia 			date
rename data_mes 			month
rename lider_da_sala_1 		leader1
rename lider_1_da_sala_2 	leader2_1
rename lider_2_da_sala_2 	leader2_2
rename versao 				version
rename azuis 				blue
rename laranjas				orange

lab var school_id 	"ID school"
lab var date 		"Day of game"
lab var month 		"Month of game"
lab var leader1 	"ID leader room 1"
lab var leader2_1 	"ID first leader room 2"
lab var leader2_2 	"ID second leader room 2"
lab var version 	"Version type dictator game"
lab var blue 		"Number of blue participants"
lab var orange 		"Number of orange participants"

drop if school_id==1 & month==51

drop final

destring j*, replace

replace orange=10 if school_id==97

***DICTATOR GAMES***

replace jda_a4_kept = . if blue==3
replace jda_a4_sent = . if blue==3
replace jda_a5_kept = . if inlist(blue,3,4)
replace jda_a5_sent = . if inlist(blue,3,4)

replace jdb_a4_kept = . if blue==3
replace jdb_a4_sent = . if blue==3
replace jdb_a5_kept = . if inlist(blue,3,4)
replace jdb_a5_sent = . if inlist(blue,3,4)

replace jdc_a4_kept = . if blue==3
replace jdc_a4_sent = . if blue==3
replace jdc_a5_kept = . if inlist(blue,3,4)
replace jdc_a5_sent = . if inlist(blue,3,4)

foreach var in jda_a1_kept jda_a1_sent jda_a2_kept jda_a2_sent jda_a3_kept jda_a3_sent jda_a4_kept jda_a4_sent jda_a5_kept jda_a5_sent jdb_a1_kept jdb_a1_sent jdb_a2_kept jdb_a2_sent jdb_a3_kept jdb_a3_sent jdb_a4_kept jdb_a4_sent jdb_a5_kept jdb_a5_sent jdc_a1_kept jdc_a1_sent jdc_a2_kept jdc_a2_sent jdc_a3_kept jdc_a3_sent jdc_a4_kept jdc_a4_sent jdc_a5_kept jdc_a5_sent{
replace `var'=. if `var'==999
}

replace jdb_a1_kept = 1500 if school_id==6
replace jdc_a4_sent = 500 if school_id==110

forval x=1/5{
gen dg_blue`x' = jda_a`x'_sent if version==1
replace dg_blue`x' = jdb_a`x'_sent if version==2
replace dg_blue`x' = jdc_a`x'_sent if version==3
}

egen dg_bluemean = rowmean(dg_blue1 dg_blue2 dg_blue3 dg_blue4 dg_blue5)

lab var dg_blue1 	"DG: sent by teacher 1"
lab var dg_blue2 	"DG: sent by teacher 2"
lab var dg_blue3 	"DG: sent by teacher 3"
lab var dg_blue4 	"DG: sent by teacher 4"
lab var dg_blue5 	"DG: sent by teacher 5"
lab var dg_bluemean		"DG: mean sent by teachers"

lab var jda_a1_kept "DG AUX"
lab var jda_a1_sent "DG AUX"
lab var jda_a2_kept "DG AUX"
lab var jda_a2_sent "DG AUX"
lab var jda_a3_kept "DG AUX"
lab var jda_a3_sent "DG AUX"
lab var jda_a4_kept "DG AUX"
lab var jda_a4_sent "DG AUX"
lab var jda_a5_kept "DG AUX"
lab var jda_a5_sent "DG AUX"
lab var jdb_a1_kept "DG AUX"
lab var jdb_a1_sent "DG AUX"
lab var jdb_a2_kept "DG AUX"
lab var jdb_a2_sent "DG AUX"
lab var jdb_a3_kept "DG AUX"
lab var jdb_a3_sent "DG AUX"
lab var jdb_a4_kept "DG AUX"
lab var jdb_a4_sent "DG AUX"
lab var jdb_a5_kept "DG AUX"
lab var jdb_a5_sent "DG AUX"
lab var jdc_a1_kept "DG AUX"
lab var jdc_a1_sent "DG AUX"
lab var jdc_a2_kept "DG AUX"
lab var jdc_a2_sent "DG AUX"
lab var jdc_a3_kept "DG AUX"
lab var jdc_a3_sent "DG AUX"
lab var jdc_a4_kept "DG AUX"
lab var jdc_a4_sent "DG AUX"
lab var jdc_a5_kept "DG AUX"
lab var jdc_a5_sent "DG AUX"

order dg_blue1 dg_blue2 dg_blue3 dg_blue4 dg_blue5 dg_bluemean,after(orange)

foreach var in jdb_a4_opi_0 jdb_a4_opi_500 jdb_a4_opi_1000 jdb_a4_opi_1500 jdb_a4_opi_2000 jdb_a5_opi_0 jdb_a5_opi_500 jdb_a5_opi_1000 jdb_a5_opi_1500 jdb_a5_opi_2000 jdc_a4_opi_0 jdc_a4_opi_500 jdc_a4_opi_1000 jdc_a4_opi_1500 jdc_a4_opi_2000 jdc_a5_opi_0 jdc_a5_opi_500 jdc_a5_opi_1000 jdc_a5_opi_1500 jdc_a5_opi_2000{
replace `var' = . if blue==3
}

foreach var in jdb_a5_opi_0 jdb_a5_opi_500 jdb_a5_opi_1000 jdb_a5_opi_1500 jdb_a5_opi_2000 jdc_a5_opi_0 jdc_a5_opi_500 jdc_a5_opi_1000 jdc_a5_opi_1500 jdc_a5_opi_2000{
replace `var' = . if blue==4
}

forval x=1/5{
gen dg_belief0_blue`x' = jdb_a`x'_opi_0 if version==2
replace dg_belief0_blue`x' = jdc_a`x'_opi_0 if version==3
}

egen dg_belief0_bluemean = rowmean(dg_belief0_blue1 dg_belief0_blue2 dg_belief0_blue3 dg_belief0_blue4 dg_belief0_blue5)

forval x=1/5{
gen dg_belief500_blue`x' = jdb_a`x'_opi_500 if version==2
replace dg_belief500_blue`x' = jdc_a`x'_opi_500 if version==3
}

egen dg_belief500_bluemean = rowmean(dg_belief500_blue1 dg_belief500_blue2 dg_belief500_blue3 dg_belief500_blue4 dg_belief500_blue5)

forval x=1/5{
gen dg_belief1000_blue`x' = jdb_a`x'_opi_1000 if version==2
replace dg_belief1000_blue`x' = jdc_a`x'_opi_1000 if version==3
}

egen dg_belief1000_bluemean = rowmean(dg_belief1000_blue1 dg_belief1000_blue2 dg_belief1000_blue3 dg_belief1000_blue4 dg_belief1000_blue5)

forval x=1/5{
gen dg_belief1500_blue`x' = jdb_a`x'_opi_1500 if version==2
replace dg_belief1500_blue`x' = jdc_a`x'_opi_1500 if version==3
}

egen dg_belief1500_bluemean = rowmean(dg_belief1500_blue1 dg_belief1500_blue2 dg_belief1500_blue3 dg_belief1500_blue4 dg_belief1500_blue5)

forval x=1/5{
gen dg_belief2000_blue`x' = jdb_a`x'_opi_2000 if version==2
replace dg_belief2000_blue`x' = jdc_a`x'_opi_2000 if version==3
}

egen dg_belief2000_bluemean = rowmean(dg_belief2000_blue1 dg_belief2000_blue2 dg_belief2000_blue3 dg_belief2000_blue4 dg_belief2000_blue5)

order dg_belief0_blue1 dg_belief0_blue2 dg_belief0_blue3 dg_belief0_blue4 dg_belief0_blue5 dg_belief0_bluemean dg_belief500_blue1 dg_belief500_blue2 dg_belief500_blue3 dg_belief500_blue4 dg_belief500_blue5 dg_belief500_bluemean dg_belief1000_blue1 dg_belief1000_blue2 dg_belief1000_blue3 dg_belief1000_blue4 dg_belief1000_blue5 dg_belief1000_bluemean dg_belief1500_blue1 dg_belief1500_blue2 dg_belief1500_blue3 dg_belief1500_blue4 dg_belief1500_blue5 dg_belief1500_bluemean dg_belief2000_blue1 dg_belief2000_blue2 dg_belief2000_blue3 dg_belief2000_blue4 dg_belief2000_blue5 dg_belief2000_bluemean, after(dg_bluemean)

lab var jdb_a1_opi_0 "DG AUX"
lab var jdb_a1_opi_500 "DG AUX"
lab var jdb_a1_opi_1000 "DG AUX"
lab var jdb_a1_opi_1500 "DG AUX"
lab var jdb_a1_opi_2000 "DG AUX"
lab var jdb_a2_opi_0 "DG AUX"
lab var jdb_a2_opi_500 "DG AUX"
lab var jdb_a2_opi_1000 "DG AUX"
lab var jdb_a2_opi_1500 "DG AUX"
lab var jdb_a2_opi_2000 "DG AUX"
lab var jdb_a3_opi_0 "DG AUX"
lab var jdb_a3_opi_500 "DG AUX"
lab var jdb_a3_opi_1000 "DG AUX"
lab var jdb_a3_opi_1500 "DG AUX"
lab var jdb_a3_opi_2000 "DG AUX"
lab var jdb_a4_opi_0 "DG AUX"
lab var jdb_a4_opi_500 "DG AUX"
lab var jdb_a4_opi_1000 "DG AUX"
lab var jdb_a4_opi_1500 "DG AUX"
lab var jdb_a4_opi_2000 "DG AUX"
lab var jdb_a5_opi_0 "DG AUX"
lab var jdb_a5_opi_500 "DG AUX"
lab var jdb_a5_opi_1000 "DG AUX"
lab var jdb_a5_opi_1500 "DG AUX"
lab var jdb_a5_opi_2000 "DG AUX"

lab var jdc_a1_opi_0 "DG AUX"
lab var jdc_a1_opi_500 "DG AUX"
lab var jdc_a1_opi_1000 "DG AUX"
lab var jdc_a1_opi_1500 "DG AUX"
lab var jdc_a1_opi_2000 "DG AUX"
lab var jdc_a2_opi_0 "DG AUX"
lab var jdc_a2_opi_500 "DG AUX"
lab var jdc_a2_opi_1000 "DG AUX"
lab var jdc_a2_opi_1500 "DG AUX"
lab var jdc_a2_opi_2000 "DG AUX"
lab var jdc_a3_opi_0 "DG AUX"
lab var jdc_a3_opi_500 "DG AUX"
lab var jdc_a3_opi_1000 "DG AUX"
lab var jdc_a3_opi_1500 "DG AUX"
lab var jdc_a3_opi_2000 "DG AUX"
lab var jdc_a4_opi_0 "DG AUX"
lab var jdc_a4_opi_500 "DG AUX"
lab var jdc_a4_opi_1000 "DG AUX"
lab var jdc_a4_opi_1500 "DG AUX"
lab var jdc_a4_opi_2000 "DG AUX"
lab var jdc_a5_opi_0 "DG AUX"
lab var jdc_a5_opi_500 "DG AUX"
lab var jdc_a5_opi_1000 "DG AUX"
lab var jdc_a5_opi_1500 "DG AUX"
lab var jdc_a5_opi_2000 "DG AUX"

lab var dg_belief0_blue1 "DG: belief of teacher 1 if sent 0"
lab var dg_belief0_blue2 "DG: belief of teacher 2 if sent 0"
lab var dg_belief0_blue3 "DG: belief of teacher 3 if sent 0"
lab var dg_belief0_blue4 "DG: belief of teacher 4 if sent 0"
lab var dg_belief0_blue5 "DG: belief of teacher 5 if sent 0"
lab var dg_belief0_bluemean "DG: mean belief of teachers if sent 0"
lab var dg_belief500_blue1 "DG: belief of teacher 1 if sent 500"
lab var dg_belief500_blue2 "DG: belief of teacher 2 if sent 500"
lab var dg_belief500_blue3 "DG: belief of teacher 3 if sent 500"
lab var dg_belief500_blue4 "DG: belief of teacher 4 if sent 500"
lab var dg_belief500_blue5 "DG: belief of teacher 5 if sent 500"
lab var dg_belief500_bluemean "DG: mean belief of teachers if sent 500"
lab var dg_belief1000_blue1 "DG: belief of teacher 1 if sent 1000"
lab var dg_belief1000_blue2 "DG: belief of teacher 2 if sent 1000"
lab var dg_belief1000_blue3 "DG: belief of teacher 3 if sent 1000"
lab var dg_belief1000_blue4 "DG: belief of teacher 4 if sent 1000"
lab var dg_belief1000_blue5 "DG: belief of teacher 5 if sent 1000"
lab var dg_belief1000_bluemean "DG: mean belief of teachers if sent 1000"
lab var dg_belief1500_blue1 "DG: belief of teacher 1 if sent 1500"
lab var dg_belief1500_blue2 "DG: belief of teacher 2 if sent 1500"
lab var dg_belief1500_blue3 "DG: belief of teacher 3 if sent 1500"
lab var dg_belief1500_blue4 "DG: belief of teacher 4 if sent 1500"
lab var dg_belief1500_blue5 "DG: belief of teacher 5 if sent 1500"
lab var dg_belief1500_bluemean "DG: mean beliefs of teachers if sent 1500"
lab var dg_belief2000_blue1 "DG: belief of teacher 1 if sent 2000"
lab var dg_belief2000_blue2 "DG: belief of teacher 2 if sent 2000"
lab var dg_belief2000_blue3 "DG: belief of teacher 3 if sent 2000"
lab var dg_belief2000_blue4 "DG: belief of teacher 4 if sent 2000"
lab var dg_belief2000_blue5 "DG: belief of teacher 5 if sent 2000"
lab var dg_belief2000_bluemean "DG: mean belief of teachers if sent 2000"

forval x=1/10{
gen dgb_faces0_orange`x' = jdb_l`x'_0
gen dgb_faces500_orange`x' = jdb_l`x'_500
gen dgb_faces1000_orange`x' = jdb_l`x'_1000
gen dgb_faces1500_orange`x' = jdb_l`x'_1500
gen dgb_faces2000_orange`x' = jdb_l`x'_2000
}
forval x=1/10{
gen dgb_belief0_orange`x' = jdb_l`x'_opi_0
gen dgb_belief500_orange`x' = jdb_l`x'_opi_500
gen dgb_belief1000_orange`x' = jdb_l`x'_opi_1000
gen dgb_belief1500_orange`x' = jdb_l`x'_opi_1500
gen dgb_belief2000_orange`x' = jdb_l`x'_opi_2000
}

forval x=1/10{
gen dgc_faces0_orange`x' = jdc_l`x'_0
gen dgc_faces500_orange`x' = jdc_l`x'_500
gen dgc_faces1000_orange`x' = jdc_l`x'_1000
gen dgc_faces1500_orange`x' = jdc_l`x'_1500
gen dgc_faces2000_orange`x' = jdc_l`x'_2000
}
forval x=1/10{
gen dgc_belief0_orange`x' = jdc_l`x'_opi_0
gen dgc_belief500_orange`x' = jdc_l`x'_opi_500
gen dgc_belief1000_orange`x' = jdc_l`x'_opi_1000
gen dgc_belief1500_orange`x' = jdc_l`x'_opi_1500
gen dgc_belief2000_orange`x' = jdc_l`x'_opi_2000
}

foreach var in dgb_faces0_orange7 dgb_faces500_orange7 dgb_faces1000_orange7 dgb_faces1500_orange7 dgb_faces2000_orange7 dgb_belief0_orange7 dgb_belief500_orange7 dgb_belief1000_orange7 dgb_belief1500_orange7 dgb_belief2000_orange7 dgc_faces0_orange7 dgc_faces500_orange7 dgc_faces1000_orange7 dgc_faces1500_orange7 dgc_faces2000_orange7 dgc_belief0_orange7 dgc_belief500_orange7 dgc_belief1000_orange7 dgc_belief1500_orange7 dgc_belief2000_orange7{
replace `var' = . if orange<7
}

foreach var in dgb_faces0_orange8 dgb_faces500_orange8 dgb_faces1000_orange8 dgb_faces1500_orange8 dgb_faces2000_orange8 dgb_belief0_orange8 dgb_belief500_orange8 dgb_belief1000_orange8 dgb_belief1500_orange8 dgb_belief2000_orange8 dgc_faces0_orange8 dgc_faces500_orange8 dgc_faces1000_orange8 dgc_faces1500_orange8 dgc_faces2000_orange8 dgc_belief0_orange8 dgc_belief500_orange8 dgc_belief1000_orange8 dgc_belief1500_orange8 dgc_belief2000_orange8{
replace `var' = . if orange<8
}

foreach var in dgb_faces0_orange9 dgb_faces500_orange9 dgb_faces1000_orange9 dgb_faces1500_orange9 dgb_faces2000_orange9 dgb_belief0_orange9 dgb_belief500_orange9 dgb_belief1000_orange9 dgb_belief1500_orange9 dgb_belief2000_orange9 dgc_faces0_orange9 dgc_faces500_orange9 dgc_faces1000_orange9 dgc_faces1500_orange9 dgc_faces2000_orange9 dgc_belief0_orange9 dgc_belief500_orange9 dgc_belief1000_orange9 dgc_belief1500_orange9 dgc_belief2000_orange9{
replace `var' = . if orange<9
}

foreach var in dgb_faces0_orange10 dgb_faces500_orange10 dgb_faces1000_orange10 dgb_faces1500_orange10 dgb_faces2000_orange10 dgb_belief0_orange10 dgb_belief500_orange10 dgb_belief1000_orange10 dgb_belief1500_orange10 dgb_belief2000_orange10 dgc_faces0_orange10 dgc_faces500_orange10 dgc_faces1000_orange10 dgc_faces1500_orange10 dgc_faces2000_orange10 dgc_belief0_orange10 dgc_belief500_orange10 dgc_belief1000_orange10 dgc_belief1500_orange10 dgc_belief2000_orange10{
replace `var' = . if orange<10
}

foreach var in dgb_faces0_orange1 dgb_faces500_orange1 dgb_faces1000_orange1 dgb_faces1500_orange1 dgb_faces2000_orange1 dgb_faces0_orange2 dgb_faces500_orange2 dgb_faces1000_orange2 dgb_faces1500_orange2 dgb_faces2000_orange2 dgb_faces0_orange3 dgb_faces500_orange3 dgb_faces1000_orange3 dgb_faces1500_orange3 dgb_faces2000_orange3 dgb_faces0_orange4 dgb_faces500_orange4 dgb_faces1000_orange4 dgb_faces1500_orange4 dgb_faces2000_orange4 dgb_faces0_orange5 dgb_faces500_orange5 dgb_faces1000_orange5 dgb_faces1500_orange5 dgb_faces2000_orange5 dgb_faces0_orange6 dgb_faces500_orange6 dgb_faces1000_orange6 dgb_faces1500_orange6 dgb_faces2000_orange6 dgb_faces0_orange7 dgb_faces500_orange7 dgb_faces1000_orange7 dgb_faces1500_orange7 dgb_faces2000_orange7 dgb_faces0_orange8 dgb_faces500_orange8 dgb_faces1000_orange8 dgb_faces1500_orange8 dgb_faces2000_orange8 dgb_faces0_orange9 dgb_faces500_orange9 dgb_faces1000_orange9 dgb_faces1500_orange9 dgb_faces2000_orange9 dgb_faces0_orange10 dgb_faces500_orange10 dgb_faces1000_orange10 dgb_faces1500_orange10 dgb_faces2000_orange10 dgb_belief0_orange1 dgb_belief500_orange1 dgb_belief1000_orange1 dgb_belief1500_orange1 dgb_belief2000_orange1 dgb_belief0_orange2 dgb_belief500_orange2 dgb_belief1000_orange2 dgb_belief1500_orange2 dgb_belief2000_orange2 dgb_belief0_orange3 dgb_belief500_orange3 dgb_belief1000_orange3 dgb_belief1500_orange3 dgb_belief2000_orange3 dgb_belief0_orange4 dgb_belief500_orange4 dgb_belief1000_orange4 dgb_belief1500_orange4 dgb_belief2000_orange4 dgb_belief0_orange5 dgb_belief500_orange5 dgb_belief1000_orange5 dgb_belief1500_orange5 dgb_belief2000_orange5 dgb_belief0_orange6 dgb_belief500_orange6 dgb_belief1000_orange6 dgb_belief1500_orange6 dgb_belief2000_orange6 dgb_belief0_orange7 dgb_belief500_orange7 dgb_belief1000_orange7 dgb_belief1500_orange7 dgb_belief2000_orange7 dgb_belief0_orange8 dgb_belief500_orange8 dgb_belief1000_orange8 dgb_belief1500_orange8 dgb_belief2000_orange8 dgb_belief0_orange9 dgb_belief500_orange9 dgb_belief1000_orange9 dgb_belief1500_orange9 dgb_belief2000_orange9 dgb_belief0_orange10 dgb_belief500_orange10 dgb_belief1000_orange10 dgb_belief1500_orange10 dgb_belief2000_orange10 dgc_faces0_orange1 dgc_faces500_orange1 dgc_faces1000_orange1 dgc_faces1500_orange1 dgc_faces2000_orange1 dgc_faces0_orange2 dgc_faces500_orange2 dgc_faces1000_orange2 dgc_faces1500_orange2 dgc_faces2000_orange2 dgc_faces0_orange3 dgc_faces500_orange3 dgc_faces1000_orange3 dgc_faces1500_orange3 dgc_faces2000_orange3 dgc_faces0_orange4 dgc_faces500_orange4 dgc_faces1000_orange4 dgc_faces1500_orange4 dgc_faces2000_orange4 dgc_faces0_orange5 dgc_faces500_orange5 dgc_faces1000_orange5 dgc_faces1500_orange5 dgc_faces2000_orange5 dgc_faces0_orange6 dgc_faces500_orange6 dgc_faces1000_orange6 dgc_faces1500_orange6 dgc_faces2000_orange6 dgc_faces0_orange7 dgc_faces500_orange7 dgc_faces1000_orange7 dgc_faces1500_orange7 dgc_faces2000_orange7 dgc_faces0_orange8 dgc_faces500_orange8 dgc_faces1000_orange8 dgc_faces1500_orange8 dgc_faces2000_orange8 dgc_faces0_orange9 dgc_faces500_orange9 dgc_faces1000_orange9 dgc_faces1500_orange9 dgc_faces2000_orange9 dgc_faces0_orange10 dgc_faces500_orange10 dgc_faces1000_orange10 dgc_faces1500_orange10 dgc_faces2000_orange10 dgc_belief0_orange1 dgc_belief500_orange1 dgc_belief1000_orange1 dgc_belief1500_orange1 dgc_belief2000_orange1 dgc_belief0_orange2 dgc_belief500_orange2 dgc_belief1000_orange2 dgc_belief1500_orange2 dgc_belief2000_orange2 dgc_belief0_orange3 dgc_belief500_orange3 dgc_belief1000_orange3 dgc_belief1500_orange3 dgc_belief2000_orange3 dgc_belief0_orange4 dgc_belief500_orange4 dgc_belief1000_orange4 dgc_belief1500_orange4 dgc_belief2000_orange4 dgc_belief0_orange5 dgc_belief500_orange5 dgc_belief1000_orange5 dgc_belief1500_orange5 dgc_belief2000_orange5 dgc_belief0_orange6 dgc_belief500_orange6 dgc_belief1000_orange6 dgc_belief1500_orange6 dgc_belief2000_orange6 dgc_belief0_orange7 dgc_belief500_orange7 dgc_belief1000_orange7 dgc_belief1500_orange7 dgc_belief2000_orange7 dgc_belief0_orange8 dgc_belief500_orange8 dgc_belief1000_orange8 dgc_belief1500_orange8 dgc_belief2000_orange8 dgc_belief0_orange9 dgc_belief500_orange9 dgc_belief1000_orange9 dgc_belief1500_orange9 dgc_belief2000_orange9 dgc_belief0_orange10 dgc_belief500_orange10 dgc_belief1000_orange10 dgc_belief1500_orange10 dgc_belief2000_orange10{
replace `var' = . if `var'==99
}

lab var jdb_l1_0 "DG AUX"
lab var jdb_l1_500 "DG AUX"
lab var jdb_l1_1000 "DG AUX"
lab var jdb_l1_1500 "DG AUX"
lab var jdb_l1_2000 "DG AUX"
lab var jdb_l2_0 "DG AUX"
lab var jdb_l2_500 "DG AUX"
lab var jdb_l2_1000 "DG AUX"
lab var jdb_l2_1500 "DG AUX"
lab var jdb_l2_2000 "DG AUX"
lab var jdb_l3_0 "DG AUX"
lab var jdb_l3_500 "DG AUX"
lab var jdb_l3_1000 "DG AUX"
lab var jdb_l3_1500 "DG AUX"
lab var jdb_l3_2000 "DG AUX"
lab var jdb_l4_0 "DG AUX"
lab var jdb_l4_500 "DG AUX"
lab var jdb_l4_1000 "DG AUX"
lab var jdb_l4_1500 "DG AUX"
lab var jdb_l4_2000 "DG AUX"
lab var jdb_l5_0 "DG AUX"
lab var jdb_l5_500 "DG AUX"
lab var jdb_l5_1000 "DG AUX"
lab var jdb_l5_1500 "DG AUX"
lab var jdb_l5_2000 "DG AUX"
lab var jdb_l6_0 "DG AUX"
lab var jdb_l6_500 "DG AUX"
lab var jdb_l6_1000 "DG AUX"
lab var jdb_l6_1500 "DG AUX"
lab var jdb_l6_2000 "DG AUX"
lab var jdb_l7_0 "DG AUX"
lab var jdb_l7_500 "DG AUX"
lab var jdb_l7_1000 "DG AUX"
lab var jdb_l7_1500 "DG AUX"
lab var jdb_l7_2000 "DG AUX"
lab var jdb_l8_0 "DG AUX"
lab var jdb_l8_500 "DG AUX"
lab var jdb_l8_1000 "DG AUX"
lab var jdb_l8_1500 "DG AUX"
lab var jdb_l8_2000 "DG AUX"
lab var jdb_l9_0 "DG AUX"
lab var jdb_l9_500 "DG AUX"
lab var jdb_l9_1000 "DG AUX"
lab var jdb_l9_1500 "DG AUX"
lab var jdb_l9_2000 "DG AUX"
lab var jdb_l10_0 "DG AUX"
lab var jdb_l10_500 "DG AUX"
lab var jdb_l10_1000 "DG AUX"
lab var jdb_l10_1500 "DG AUX"
lab var jdb_l10_2000 "DG AUX"
lab var jdb_l1_opi_0 "DG AUX"
lab var jdb_l1_opi_500 "DG AUX"
lab var jdb_l1_opi_1000 "DG AUX"
lab var jdb_l1_opi_1500 "DG AUX"
lab var jdb_l1_opi_2000 "DG AUX"
lab var jdb_l2_opi_0 "DG AUX"
lab var jdb_l2_opi_500 "DG AUX"
lab var jdb_l2_opi_1000 "DG AUX"
lab var jdb_l2_opi_1500 "DG AUX"
lab var jdb_l2_opi_2000 "DG AUX"
lab var jdb_l3_opi_0 "DG AUX"
lab var jdb_l3_opi_500 "DG AUX"
lab var jdb_l3_opi_1000 "DG AUX"
lab var jdb_l3_opi_1500 "DG AUX"
lab var jdb_l3_opi_2000 "DG AUX"
lab var jdb_l4_opi_0 "DG AUX"
lab var jdb_l4_opi_500 "DG AUX"
lab var jdb_l4_opi_1000 "DG AUX"
lab var jdb_l4_opi_1500 "DG AUX"
lab var jdb_l4_opi_2000 "DG AUX"
lab var jdb_l5_opi_0 "DG AUX"
lab var jdb_l5_opi_500 "DG AUX"
lab var jdb_l5_opi_1000 "DG AUX"
lab var jdb_l5_opi_1500 "DG AUX"
lab var jdb_l5_opi_2000 "DG AUX"
lab var jdb_l6_opi_0 "DG AUX"
lab var jdb_l6_opi_500 "DG AUX"
lab var jdb_l6_opi_1000 "DG AUX"
lab var jdb_l6_opi_1500 "DG AUX"
lab var jdb_l6_opi_2000 "DG AUX"
lab var jdb_l7_opi_0 "DG AUX"
lab var jdb_l7_opi_500 "DG AUX"
lab var jdb_l7_opi_1000 "DG AUX"
lab var jdb_l7_opi_1500 "DG AUX"
lab var jdb_l7_opi_2000 "DG AUX"
lab var jdb_l8_opi_0 "DG AUX"
lab var jdb_l8_opi_500 "DG AUX"
lab var jdb_l8_opi_1000 "DG AUX"
lab var jdb_l8_opi_1500 "DG AUX"
lab var jdb_l8_opi_2000 "DG AUX"
lab var jdb_l9_opi_0 "DG AUX"
lab var jdb_l9_opi_500 "DG AUX"
lab var jdb_l9_opi_1000 "DG AUX"
lab var jdb_l9_opi_1500 "DG AUX"
lab var jdb_l9_opi_2000 "DG AUX"
lab var jdb_l10_opi_0 "DG AUX"
lab var jdb_l10_opi_500 "DG AUX"
lab var jdb_l10_opi_1000 "DG AUX"
lab var jdb_l10_opi_1500 "DG AUX"
lab var jdb_l10_opi_2000 "DG AUX"

lab var jdc_l1_0 "DG AUX"
lab var jdc_l1_500 "DG AUX"
lab var jdc_l1_1000 "DG AUX"
lab var jdc_l1_1500 "DG AUX"
lab var jdc_l1_2000 "DG AUX"
lab var jdc_l2_0 "DG AUX"
lab var jdc_l2_500 "DG AUX"
lab var jdc_l2_1000 "DG AUX"
lab var jdc_l2_1500 "DG AUX"
lab var jdc_l2_2000 "DG AUX"
lab var jdc_l3_0 "DG AUX"
lab var jdc_l3_500 "DG AUX"
lab var jdc_l3_1000 "DG AUX"
lab var jdc_l3_1500 "DG AUX"
lab var jdc_l3_2000 "DG AUX"
lab var jdc_l4_0 "DG AUX"
lab var jdc_l4_500 "DG AUX"
lab var jdc_l4_1000 "DG AUX"
lab var jdc_l4_1500 "DG AUX"
lab var jdc_l4_2000 "DG AUX"
lab var jdc_l5_0 "DG AUX"
lab var jdc_l5_500 "DG AUX"
lab var jdc_l5_1000 "DG AUX"
lab var jdc_l5_1500 "DG AUX"
lab var jdc_l5_2000 "DG AUX"
lab var jdc_l6_0 "DG AUX"
lab var jdc_l6_500 "DG AUX"
lab var jdc_l6_1000 "DG AUX"
lab var jdc_l6_1500 "DG AUX"
lab var jdc_l6_2000 "DG AUX"
lab var jdc_l7_0 "DG AUX"
lab var jdc_l7_500 "DG AUX"
lab var jdc_l7_1000 "DG AUX"
lab var jdc_l7_1500 "DG AUX"
lab var jdc_l7_2000 "DG AUX"
lab var jdc_l8_0 "DG AUX"
lab var jdc_l8_500 "DG AUX"
lab var jdc_l8_1000 "DG AUX"
lab var jdc_l8_1500 "DG AUX"
lab var jdc_l8_2000 "DG AUX"
lab var jdc_l9_0 "DG AUX"
lab var jdc_l9_500 "DG AUX"
lab var jdc_l9_1000 "DG AUX"
lab var jdc_l9_1500 "DG AUX"
lab var jdc_l9_2000 "DG AUX"
lab var jdc_l10_0 "DG AUX"
lab var jdc_l10_500 "DG AUX"
lab var jdc_l10_1000 "DG AUX"
lab var jdc_l10_1500 "DG AUX"
lab var jdc_l10_2000 "DG AUX"
lab var jdc_l1_opi_0 "DG AUX"
lab var jdc_l1_opi_500 "DG AUX"
lab var jdc_l1_opi_1000 "DG AUX"
lab var jdc_l1_opi_1500 "DG AUX"
lab var jdc_l1_opi_2000 "DG AUX"
lab var jdc_l2_opi_0 "DG AUX"
lab var jdc_l2_opi_500 "DG AUX"
lab var jdc_l2_opi_1000 "DG AUX"
lab var jdc_l2_opi_1500 "DG AUX"
lab var jdc_l2_opi_2000 "DG AUX"
lab var jdc_l3_opi_0 "DG AUX"
lab var jdc_l3_opi_500 "DG AUX"
lab var jdc_l3_opi_1000 "DG AUX"
lab var jdc_l3_opi_1500 "DG AUX"
lab var jdc_l3_opi_2000 "DG AUX"
lab var jdc_l4_opi_0 "DG AUX"
lab var jdc_l4_opi_500 "DG AUX"
lab var jdc_l4_opi_1000 "DG AUX"
lab var jdc_l4_opi_1500 "DG AUX"
lab var jdc_l4_opi_2000 "DG AUX"
lab var jdc_l5_opi_0 "DG AUX"
lab var jdc_l5_opi_500 "DG AUX"
lab var jdc_l5_opi_1000 "DG AUX"
lab var jdc_l5_opi_1500 "DG AUX"
lab var jdc_l5_opi_2000 "DG AUX"
lab var jdc_l6_opi_0 "DG AUX"
lab var jdc_l6_opi_500 "DG AUX"
lab var jdc_l6_opi_1000 "DG AUX"
lab var jdc_l6_opi_1500 "DG AUX"
lab var jdc_l6_opi_2000 "DG AUX"
lab var jdc_l7_opi_0 "DG AUX"
lab var jdc_l7_opi_500 "DG AUX"
lab var jdc_l7_opi_1000 "DG AUX"
lab var jdc_l7_opi_1500 "DG AUX"
lab var jdc_l7_opi_2000 "DG AUX"
lab var jdc_l8_opi_0 "DG AUX"
lab var jdc_l8_opi_500 "DG AUX"
lab var jdc_l8_opi_1000 "DG AUX"
lab var jdc_l8_opi_1500 "DG AUX"
lab var jdc_l8_opi_2000 "DG AUX"
lab var jdc_l9_opi_0 "DG AUX"
lab var jdc_l9_opi_500 "DG AUX"
lab var jdc_l9_opi_1000 "DG AUX"
lab var jdc_l9_opi_1500 "DG AUX"
lab var jdc_l9_opi_2000 "DG AUX"
lab var jdc_l10_opi_0 "DG AUX"
lab var jdc_l10_opi_500 "DG AUX"
lab var jdc_l10_opi_1000 "DG AUX"
lab var jdc_l10_opi_1500 "DG AUX"
lab var jdc_l10_opi_2000 "DG AUX"

order dgb_faces0_orange* dgb_faces500_orange* dgb_faces1000_orange* dgb_faces1500_orange* dgb_faces2000_orange* dgb_belief0_orange* dgb_belief500_orange* dgb_belief1000_orange* dgb_belief1500_orange* dgb_belief2000_orange* dgc_faces0_orange* dgc_faces500_orange* dgc_faces1000_orange* dgc_faces1500_orange* dgc_faces2000_orange* dgc_belief0_orange* dgc_belief500_orange* dgc_belief1000_orange* dgc_belief1500_orange* dgc_belief2000_orange*, after(dg_belief2000_bluemean)


lab var dgb_faces0_orange1 "DG [B]: faces decision by parent rep 1 if received 0"
lab var dgb_faces500_orange1 "DG [B]: faces decision by parent rep 1 if received 500"
lab var dgb_faces1000_orange1 "DG [B]: faces decision by parent rep 1 if received 1000"
lab var dgb_faces1500_orange1 "DG [B]: faces decision by parent rep 1 if received 1500"
lab var dgb_faces2000_orange1 "DG [B]: faces decision by parent rep 1 if received 2000"
lab var dgb_faces0_orange2 "DG [B]: faces decision by parent rep 2 if received 0"
lab var dgb_faces500_orange2 "DG [B]: faces decision by parent rep 2 if received 500"
lab var dgb_faces1000_orange2 "DG [B]: faces decision by parent rep 2 if received 1000"
lab var dgb_faces1500_orange2 "DG [B]: faces decision by parent rep 2 if received 1500"
lab var dgb_faces2000_orange2 "DG [B]: faces decision by parent rep 2 if received 2000"
lab var dgb_faces0_orange3 "DG [B]: faces decision by parent rep 3 if received 0"
lab var dgb_faces500_orange3 "DG [B]: faces decision by parent rep 3 if received 500"
lab var dgb_faces1000_orange3 "DG [B]: faces decision by parent rep 3 if received 1000"
lab var dgb_faces1500_orange3 "DG [B]: faces decision by parent rep 3 if received 1500"
lab var dgb_faces2000_orange3 "DG [B]: faces decision by parent rep 3 if received 2000"
lab var dgb_faces0_orange4 "DG [B]: faces decision by parent rep 4 if received 0"
lab var dgb_faces500_orange4 "DG [B]: faces decision by parent rep 4 if received 500"
lab var dgb_faces1000_orange4 "DG [B]: faces decision by parent rep 4 if received 1000"
lab var dgb_faces1500_orange4 "DG [B]: faces decision by parent rep 4 if received 1500"
lab var dgb_faces2000_orange4 "DG [B]: faces decision by parent rep 4 if received 2000"
lab var dgb_faces0_orange5 "DG [B]: faces decision by parent rep 5 if received 0"
lab var dgb_faces500_orange5 "DG [B]: faces decision by parent rep 5 if received 500"
lab var dgb_faces1000_orange5 "DG [B]: faces decision by parent rep 5 if received 1000"
lab var dgb_faces1500_orange5 "DG [B]: faces decision by parent rep 5 if received 1500"
lab var dgb_faces2000_orange5 "DG [B]: faces decision by parent rep 5 if received 2000"
lab var dgb_faces0_orange6 "DG [B]: faces decision by parent rep 6 if received 0"
lab var dgb_faces500_orange6 "DG [B]: faces decision by parent rep 6 if received 500"
lab var dgb_faces1000_orange6 "DG [B]: faces decision by parent rep 6 if received 1000"
lab var dgb_faces1500_orange6 "DG [B]: faces decision by parent rep 6 if received 1500"
lab var dgb_faces2000_orange6 "DG [B]: faces decision by parent rep 6 if received 2000"
lab var dgb_faces0_orange7 "DG [B]: faces decision by parent rep 7 if received 0"
lab var dgb_faces500_orange7 "DG [B]: faces decision by parent rep 7 if received 500"
lab var dgb_faces1000_orange7 "DG [B]: faces decision by parent rep 7 if received 1000"
lab var dgb_faces1500_orange7 "DG [B]: faces decision by parent rep 7 if received 1500"
lab var dgb_faces2000_orange7 "DG [B]: faces decision by parent rep 7 if received 2000"
lab var dgb_faces0_orange8 "DG [B]: faces decision by parent rep 8 if received 0"
lab var dgb_faces500_orange8 "DG [B]: faces decision by parent rep 8 if received 500"
lab var dgb_faces1000_orange8 "DG [B]: faces decision by parent rep  if received 1000"
lab var dgb_faces1500_orange8 "DG [B]: faces decision by parent rep 8 if received 1500"
lab var dgb_faces2000_orange8 "DG [B]: faces decision by parent rep 8 if received 2000"
lab var dgb_faces0_orange9 "DG [B]: faces decision by parent rep 9 if received 0"
lab var dgb_faces500_orange9 "DG [B]: faces decision by parent rep 9 if received 500"
lab var dgb_faces1000_orange9 "DG [B]: faces decision by parent rep 9 if received 1000"
lab var dgb_faces1500_orange9 "DG [B]: faces decision by parent rep 9 if received 1500"
lab var dgb_faces2000_orange9 "DG [B]: faces decision by parent rep 9 if received 2000"
lab var dgb_faces0_orange10 "DG [B]: faces decision by parent rep 10 if received 0"
lab var dgb_faces500_orange10 "DG [B]: faces decision by parent rep 10 if received 500"
lab var dgb_faces1000_orange10 "DG [B]: faces decision by parent rep 10 if received 1000"
lab var dgb_faces1500_orange10 "DG [B]: faces decision by parent rep 10 if received 1500"
lab var dgb_faces2000_orange10 "DG [B]: faces decision by parent rep 10 if received 2000"
lab var dgb_belief0_orange1 "DG [B]: faces belief by parent 1 if received 0"
lab var dgb_belief500_orange1 "DG [B]: faces belief by parent 1 if received 500"
lab var dgb_belief1000_orange1 "DG [B]: faces belief by parent 1 if received 1000"
lab var dgb_belief1500_orange1 "DG [B]: faces belief by parent 1 if received 1500"
lab var dgb_belief2000_orange1 "DG [B]: faces belief by parent 1 if received 2000"
lab var dgb_belief0_orange2 "DG [B]: faces belief by parent 2 if received 0"
lab var dgb_belief500_orange2 "DG [B]: faces belief by parent 2 if received 500"
lab var dgb_belief1000_orange2 "DG [B]: faces belief by parent 2 if received 1000"
lab var dgb_belief1500_orange2 "DG [B]: faces belief by parent 2 if received 1500"
lab var dgb_belief2000_orange2 "DG [B]: faces belief by parent 2 if received 2000"
lab var dgb_belief0_orange3 "DG [B]: faces belief by parent 3 if received 0"
lab var dgb_belief500_orange3 "DG [B]: faces belief by parent 3 if received 500"
lab var dgb_belief1000_orange3 "DG [B]: faces belief by parent 3 if received 1000"
lab var dgb_belief1500_orange3 "DG [B]: faces belief by parent 3 if received 1500"
lab var dgb_belief2000_orange3 "DG [B]: faces belief by parent 3 if received 2000"
lab var dgb_belief0_orange4 "DG [B]: faces belief by parent 4 if received 0"
lab var dgb_belief500_orange4 "DG [B]: faces belief by parent 4 if received 500"
lab var dgb_belief1000_orange4 "DG [B]: faces belief by parent 4 if received 1000"
lab var dgb_belief1500_orange4 "DG [B]: faces belief by parent 4 if received 1500"
lab var dgb_belief2000_orange4 "DG [B]: faces belief by parent 4 if received 2000"
lab var dgb_belief0_orange5 "DG [B]: faces belief by parent 5 if received 0"
lab var dgb_belief500_orange5 "DG [B]: faces belief by parent 5 if received 500"
lab var dgb_belief1000_orange5 "DG [B]: faces belief by parent 5 if received 1000"
lab var dgb_belief1500_orange5 "DG [B]: faces belief by parent 5 if received 1500"
lab var dgb_belief2000_orange5 "DG [B]: faces belief by parent 5 if received 2000"
lab var dgb_belief0_orange6 "DG [B]: faces belief by parent 6 if received 0"
lab var dgb_belief500_orange6 "DG [B]: faces belief by parent 6 if received 500"
lab var dgb_belief1000_orange6 "DG [B]: faces belief by parent 6 if received 1000"
lab var dgb_belief1500_orange6 "DG [B]: faces belief by parent 6 if received 1500"
lab var dgb_belief2000_orange6 "DG [B]: faces belief by parent 6 if received 2000"
lab var dgb_belief0_orange7 "DG [B]: faces belief by parent 7 if received 0"
lab var dgb_belief500_orange7 "DG [B]: faces belief by parent 7 if received 500"
lab var dgb_belief1000_orange7 "DG [B]: faces belief by parent 7 if received 1000"
lab var dgb_belief1500_orange7 "DG [B]: faces belief by parent 7 if received 1500"
lab var dgb_belief2000_orange7 "DG [B]: faces belief by parent 7 if received 2000"
lab var dgb_belief0_orange8 "DG [B]: faces belief by parent 8 if received 0"
lab var dgb_belief500_orange8 "DG [B]: faces belief by parent 8 if received 500"
lab var dgb_belief1000_orange8 "DG [B]: faces belief by parent  if received 1000"
lab var dgb_belief1500_orange8 "DG [B]: faces belief by parent 8 if received 1500"
lab var dgb_belief2000_orange8 "DG [B]: faces belief by parent 8 if received 2000"
lab var dgb_belief0_orange9 "DG [B]: faces belief by parent 9 if received 0"
lab var dgb_belief500_orange9 "DG [B]: faces belief by parent 9 if received 500"
lab var dgb_belief1000_orange9 "DG [B]: faces belief by parent 9 if received 1000"
lab var dgb_belief1500_orange9 "DG [B]: faces belief by parent 9 if received 1500"
lab var dgb_belief2000_orange9 "DG [B]: faces belief by parent 9 if received 2000"
lab var dgb_belief0_orange10 "DG [B]: faces belief by parent 10 if received 0"
lab var dgb_belief500_orange10 "DG [B]: faces belief by parent 10 if received 500"
lab var dgb_belief1000_orange10 "DG [B]: faces belief by parent 10 if received 1000"
lab var dgb_belief1500_orange10 "DG [B]: faces belief by parent 10 if received 1500"
lab var dgb_belief2000_orange10 "DG [B]: faces belief by parent 10 if received 2000"
lab var dgc_faces0_orange1 "DG [C]: faces decision by parent rep 1 if received 0"
lab var dgc_faces500_orange1 "DG [C]: faces decision by parent rep 1 if received 500"
lab var dgc_faces1000_orange1 "DG [C]: faces decision by parent rep 1 if received 1000"
lab var dgc_faces1500_orange1 "DG [C]: faces decision by parent rep 1 if received 1500"
lab var dgc_faces2000_orange1 "DG [C]: faces decision by parent rep 1 if received 2000"
lab var dgc_faces0_orange2 "DG [C]: faces decision by parent rep 2 if received 0"
lab var dgc_faces500_orange2 "DG [C]: faces decision by parent rep 2 if received 500"
lab var dgc_faces1000_orange2 "DG [C]: faces decision by parent rep 2 if received 1000"
lab var dgc_faces1500_orange2 "DG [C]: faces decision by parent rep 2 if received 1500"
lab var dgc_faces2000_orange2 "DG [C]: faces decision by parent rep 2 if received 2000"
lab var dgc_faces0_orange3 "DG [C]: faces decision by parent rep 3 if received 0"
lab var dgc_faces500_orange3 "DG [C]: faces decision by parent rep 3 if received 500"
lab var dgc_faces1000_orange3 "DG [C]: faces decision by parent rep 3 if received 1000"
lab var dgc_faces1500_orange3 "DG [C]: faces decision by parent rep 3 if received 1500"
lab var dgc_faces2000_orange3 "DG [C]: faces decision by parent rep 3 if received 2000"
lab var dgc_faces0_orange4 "DG [C]: faces decision by parent rep 4 if received 0"
lab var dgc_faces500_orange4 "DG [C]: faces decision by parent rep 4 if received 500"
lab var dgc_faces1000_orange4 "DG [C]: faces decision by parent rep 4 if received 1000"
lab var dgc_faces1500_orange4 "DG [C]: faces decision by parent rep 4 if received 1500"
lab var dgc_faces2000_orange4 "DG [C]: faces decision by parent rep 4 if received 2000"
lab var dgc_faces0_orange5 "DG [C]: faces decision by parent rep 5 if received 0"
lab var dgc_faces500_orange5 "DG [C]: faces decision by parent rep 5 if received 500"
lab var dgc_faces1000_orange5 "DG [C]: faces decision by parent rep 5 if received 1000"
lab var dgc_faces1500_orange5 "DG [C]: faces decision by parent rep 5 if received 1500"
lab var dgc_faces2000_orange5 "DG [C]: faces decision by parent rep 5 if received 2000"
lab var dgc_faces0_orange6 "DG [C]: faces decision by parent rep 6 if received 0"
lab var dgc_faces500_orange6 "DG [C]: faces decision by parent rep 6 if received 500"
lab var dgc_faces1000_orange6 "DG [C]: faces decision by parent rep 6 if received 1000"
lab var dgc_faces1500_orange6 "DG [C]: faces decision by parent rep 6 if received 1500"
lab var dgc_faces2000_orange6 "DG [C]: faces decision by parent rep 6 if received 2000"
lab var dgc_faces0_orange7 "DG [C]: faces decision by parent rep 7 if received 0"
lab var dgc_faces500_orange7 "DG [C]: faces decision by parent rep 7 if received 500"
lab var dgc_faces1000_orange7 "DG [C]: faces decision by parent rep 7 if received 1000"
lab var dgc_faces1500_orange7 "DG [C]: faces decision by parent rep 7 if received 1500"
lab var dgc_faces2000_orange7 "DG [C]: faces decision by parent rep 7 if received 2000"
lab var dgc_faces0_orange8 "DG [C]: faces decision by parent rep 8 if received 0"
lab var dgc_faces500_orange8 "DG [C]: faces decision by parent rep 8 if received 500"
lab var dgc_faces1000_orange8 "DG [C]: faces decision by parent rep  if received 1000"
lab var dgc_faces1500_orange8 "DG [C]: faces decision by parent rep 8 if received 1500"
lab var dgc_faces2000_orange8 "DG [C]: faces decision by parent rep 8 if received 2000"
lab var dgc_faces0_orange9 "DG [C]: faces decision by parent rep 9 if received 0"
lab var dgc_faces500_orange9 "DG [C]: faces decision by parent rep 9 if received 500"
lab var dgc_faces1000_orange9 "DG [C]: faces decision by parent rep 9 if received 1000"
lab var dgc_faces1500_orange9 "DG [C]: faces decision by parent rep 9 if received 1500"
lab var dgc_faces2000_orange9 "DG [C]: faces decision by parent rep 9 if received 2000"
lab var dgc_faces0_orange10 "DG [C]: faces decision by parent rep 10 if received 0"
lab var dgc_faces500_orange10 "DG [C]: faces decision by parent rep 10 if received 500"
lab var dgc_faces1000_orange10 "DG [C]: faces decision by parent rep 10 if received 1000"
lab var dgc_faces1500_orange10 "DG [C]: faces decision by parent rep 10 if received 1500"
lab var dgc_faces2000_orange10 "DG [C]: faces decision by parent rep 10 if received 2000"
lab var dgc_belief0_orange1 "DG [C]: faces belief by parent 1 if received 0"
lab var dgc_belief500_orange1 "DG [C]: faces belief by parent 1 if received 500"
lab var dgc_belief1000_orange1 "DG [C]: faces belief by parent 1 if received 1000"
lab var dgc_belief1500_orange1 "DG [C]: faces belief by parent 1 if received 1500"
lab var dgc_belief2000_orange1 "DG [C]: faces belief by parent 1 if received 2000"
lab var dgc_belief0_orange2 "DG [C]: faces belief by parent 2 if received 0"
lab var dgc_belief500_orange2 "DG [C]: faces belief by parent 2 if received 500"
lab var dgc_belief1000_orange2 "DG [C]: faces belief by parent 2 if received 1000"
lab var dgc_belief1500_orange2 "DG [C]: faces belief by parent 2 if received 1500"
lab var dgc_belief2000_orange2 "DG [C]: faces belief by parent 2 if received 2000"
lab var dgc_belief0_orange3 "DG [C]: faces belief by parent 3 if received 0"
lab var dgc_belief500_orange3 "DG [C]: faces belief by parent 3 if received 500"
lab var dgc_belief1000_orange3 "DG [C]: faces belief by parent 3 if received 1000"
lab var dgc_belief1500_orange3 "DG [C]: faces belief by parent 3 if received 1500"
lab var dgc_belief2000_orange3 "DG [C]: faces belief by parent 3 if received 2000"
lab var dgc_belief0_orange4 "DG [C]: faces belief by parent 4 if received 0"
lab var dgc_belief500_orange4 "DG [C]: faces belief by parent 4 if received 500"
lab var dgc_belief1000_orange4 "DG [C]: faces belief by parent 4 if received 1000"
lab var dgc_belief1500_orange4 "DG [C]: faces belief by parent 4 if received 1500"
lab var dgc_belief2000_orange4 "DG [C]: faces belief by parent 4 if received 2000"
lab var dgc_belief0_orange5 "DG [C]: faces belief by parent 5 if received 0"
lab var dgc_belief500_orange5 "DG [C]: faces belief by parent 5 if received 500"
lab var dgc_belief1000_orange5 "DG [C]: faces belief by parent 5 if received 1000"
lab var dgc_belief1500_orange5 "DG [C]: faces belief by parent 5 if received 1500"
lab var dgc_belief2000_orange5 "DG [C]: faces belief by parent 5 if received 2000"
lab var dgc_belief0_orange6 "DG [C]: faces belief by parent 6 if received 0"
lab var dgc_belief500_orange6 "DG [C]: faces belief by parent 6 if received 500"
lab var dgc_belief1000_orange6 "DG [C]: faces belief by parent 6 if received 1000"
lab var dgc_belief1500_orange6 "DG [C]: faces belief by parent 6 if received 1500"
lab var dgc_belief2000_orange6 "DG [C]: faces belief by parent 6 if received 2000"
lab var dgc_belief0_orange7 "DG [C]: faces belief by parent 7 if received 0"
lab var dgc_belief500_orange7 "DG [C]: faces belief by parent 7 if received 500"
lab var dgc_belief1000_orange7 "DG [C]: faces belief by parent 7 if received 1000"
lab var dgc_belief1500_orange7 "DG [C]: faces belief by parent 7 if received 1500"
lab var dgc_belief2000_orange7 "DG [C]: faces belief by parent 7 if received 2000"
lab var dgc_belief0_orange8 "DG [C]: faces belief by parent 8 if received 0"
lab var dgc_belief500_orange8 "DG [C]: faces belief by parent 8 if received 500"
lab var dgc_belief1000_orange8 "DG [C]: faces belief by parent  if received 1000"
lab var dgc_belief1500_orange8 "DG [C]: faces belief by parent 8 if received 1500"
lab var dgc_belief2000_orange8 "DG [C]: faces belief by parent 8 if received 2000"
lab var dgc_belief0_orange9 "DG [C]: faces belief by parent 9 if received 0"
lab var dgc_belief500_orange9 "DG [C]: faces belief by parent 9 if received 500"
lab var dgc_belief1000_orange9 "DG [C]: faces belief by parent 9 if received 1000"
lab var dgc_belief1500_orange9 "DG [C]: faces belief by parent 9 if received 1500"
lab var dgc_belief2000_orange9 "DG [C]: faces belief by parent 9 if received 2000"
lab var dgc_belief0_orange10 "DG [C]: faces belief by parent 10 if received 0"
lab var dgc_belief500_orange10 "DG [C]: faces belief by parent 10 if received 500"
lab var dgc_belief1000_orange10 "DG [C]: faces belief by parent 10 if received 1000"
lab var dgc_belief1500_orange10 "DG [C]: faces belief by parent 10 if received 1500"
lab var dgc_belief2000_orange10 "DG [C]: faces belief by parent 10 if received 2000"

egen dgb_faces0_orangemean = rowmean(dgb_faces0_orange*)
egen dgb_faces500_orangemean = rowmean(dgb_faces500_orange*)
egen dgb_faces1000_orangemean = rowmean(dgb_faces1000_orange*)
egen dgb_faces1500_orangemean = rowmean(dgb_faces1500_orange*)
egen dgb_faces2000_orangemean = rowmean(dgb_faces2000_orange*)

gen dgb_faces0_orangemean_i = dgb_faces0_orangemean/5
gen dgb_faces500_orangemean_i = dgb_faces500_orangemean/5
gen dgb_faces1000_orangemean_i = dgb_faces1000_orangemean/5
gen dgb_faces1500_orangemean_i = dgb_faces1500_orangemean/5
gen dgb_faces2000_orangemean_i = dgb_faces2000_orangemean/5

egen dgc_faces0_orangemean = rowmean(dgc_faces0_orange*)
egen dgc_faces500_orangemean = rowmean(dgc_faces500_orange*)
egen dgc_faces1000_orangemean = rowmean(dgc_faces1000_orange*)
egen dgc_faces1500_orangemean = rowmean(dgc_faces1500_orange*)
egen dgc_faces2000_orangemean = rowmean(dgc_faces2000_orange*)

order dgb_faces0_orangemean dgb_faces500_orangemean dgb_faces1000_orangemean dgb_faces1500_orangemean dgb_faces2000_orangemean dgb_faces0_orangemean_i dgb_faces500_orangemean_i dgb_faces1000_orangemean_i dgb_faces1500_orangemean_i dgb_faces2000_orangemean_i dgc_faces0_orangemean dgc_faces500_orangemean dgc_faces1000_orangemean dgc_faces1500_orangemean dgc_faces2000_orangemean,after(dgc_belief2000_orange10)

lab var dgb_faces0_orangemean "DG [B]: mean faces decision by parent reps if received 0"
lab var dgb_faces500_orangemean "DG [B]: mean faces decision by parent reps if received 500"
lab var dgb_faces1000_orangemean "DG [B]: mean faces decision by parent reps if received 1000"
lab var dgb_faces1500_orangemean "DG [B]: mean faces decision by parent reps if received 1500"
lab var dgb_faces2000_orangemean "DG [B]: mean faces decision by parent reps if received 2000"
lab var dgb_faces0_orangemean_i "DG [B]: mean ind. faces decision by parent reps if received 0"
lab var dgb_faces500_orangemean_i "DG [B]: mean ind. faces decision by parent reps if received 500"
lab var dgb_faces1000_orangemean_i "DG [B]: mean ind. faces decision by parent reps if received 1000"
lab var dgb_faces1500_orangemean_i "DG [B]: mean ind. faces decision by parent reps if received 1500"
lab var dgb_faces2000_orangemean_i "DG [B]: mean ind. faces decision by parent reps if received 2000"
lab var dgc_faces0_orangemean "DG [B]: mean faces decision by parents if received 0"
lab var dgc_faces500_orangemean "DG [B]: mean faces decision by parents if received 500"
lab var dgc_faces1000_orangemean "DG [B]: mean faces decision by parents if received 1000"
lab var dgc_faces1500_orangemean "DG [B]: mean faces decision by parents if received 1500"
lab var dgc_faces2000_orangemean "DG [B]: mean faces decision by parents if received 2000"

***TRUST GAMES***

replace jc_l7_kept = . if orange<7
replace jc_l8_kept = . if orange<8
replace jc_l9_kept = . if orange<9
replace jc_l10_kept = . if orange<10

replace jc_l7_sent = . if orange<7
replace jc_l8_sent = . if orange<8
replace jc_l9_sent = . if orange<9
replace jc_l10_sent = . if orange<10

forval x=1/10 {
gen tg_orange`x' = jc_l`x'_sent
}

order tg_orange1 tg_orange2 tg_orange3 tg_orange4 tg_orange5 tg_orange6 tg_orange7 tg_orange8 tg_orange9 tg_orange10,after(dgc_faces2000_orangemean)

lab var tg_orange1 "TG: sent by parent 1"
lab var tg_orange2 "TG: sent by parent 2"
lab var tg_orange3 "TG: sent by parent 3"
lab var tg_orange4 "TG: sent by parent 4"
lab var tg_orange5 "TG: sent by parent 5"
lab var tg_orange6 "TG: sent by parent 6"
lab var tg_orange7 "TG: sent by parent 7"
lab var tg_orange8 "TG: sent by parent 8"
lab var tg_orange9 "TG: sent by parent 9"
lab var tg_orange10 "TG: sent by parent 10"

replace jc_a4_200   = . if blue<4
replace jc_a4_400   = . if blue<4
replace jc_a4_600   = . if blue<4
replace jc_a4_800   = . if blue<4
replace jc_a5_200   = . if blue<5
replace jc_a5_400   = . if blue<5
replace jc_a5_600   = . if blue<5
replace jc_a5_800   = . if blue<5

foreach var in jc_a1_200 jc_a1_400 jc_a1_600 jc_a1_800 jc_a2_200 jc_a2_400 jc_a2_600 jc_a2_800 jc_a3_200 jc_a3_400 jc_a3_600 jc_a3_800 jc_a4_200 jc_a4_400 jc_a4_600 jc_a4_800 jc_a5_200 jc_a5_400 jc_a5_600 jc_a5_800{
replace `var' = . if `var'==999
}

forval x=1/5 {
gen tg_return200_blue`x' = jc_a`x'_200
gen tg_return400_blue`x' = jc_a`x'_400
gen tg_return600_blue`x' = jc_a`x'_600
gen tg_return800_blue`x' = jc_a`x'_800
}

order tg_return200_blue* tg_return400_blue* tg_return600_blue* tg_return800_blue*, after(tg_orange10)

lab var tg_return200_blue1 "TG: return decision by teacher 1 if received 200"
lab var tg_return400_blue1 "TG: return decision by teacher 1 if received 400"
lab var tg_return600_blue1 "TG: return decision by teacher 1 if received 600"
lab var tg_return800_blue1 "TG: return decision by teacher 1 if received 800"
lab var tg_return200_blue2 "TG: return decision by teacher 2 if received 200"
lab var tg_return400_blue2 "TG: return decision by teacher 2 if received 400"
lab var tg_return600_blue2 "TG: return decision by teacher 2 if received 600"
lab var tg_return800_blue2 "TG: return decision by teacher 2 if received 800"
lab var tg_return200_blue3 "TG: return decision by teacher 3 if received 200"
lab var tg_return400_blue3 "TG: return decision by teacher 3 if received 400"
lab var tg_return600_blue3 "TG: return decision by teacher 3 if received 600"
lab var tg_return800_blue3 "TG: return decision by teacher 3 if received 800"
lab var tg_return200_blue4 "TG: return decision by teacher 4 if received 200"
lab var tg_return400_blue4 "TG: return decision by teacher 4 if received 400"
lab var tg_return600_blue4 "TG: return decision by teacher 4 if received 600"
lab var tg_return800_blue4 "TG: return decision by teacher 4 if received 800"
lab var tg_return200_blue5 "TG: return decision by teacher 5 if received 200"
lab var tg_return400_blue5 "TG: return decision by teacher 5 if received 400"
lab var tg_return600_blue5 "TG: return decision by teacher 5 if received 600"
lab var tg_return800_blue5 "TG: return decision by teacher 5 if received 800"

lab var jc_l1_kept "TG AUX"
lab var jc_l1_sent "TG AUX"
lab var jc_l2_kept "TG AUX"
lab var jc_l2_sent "TG AUX"
lab var jc_l3_kept "TG AUX"
lab var jc_l3_sent "TG AUX"
lab var jc_l4_kept "TG AUX"
lab var jc_l4_sent "TG AUX"
lab var jc_l5_kept "TG AUX"
lab var jc_l5_sent "TG AUX"
lab var jc_l6_kept "TG AUX"
lab var jc_l6_sent "TG AUX"
lab var jc_l7_kept "TG AUX"
lab var jc_l7_sent "TG AUX"
lab var jc_l8_kept "TG AUX"
lab var jc_l8_sent "TG AUX"
lab var jc_l9_kept "TG AUX"
lab var jc_l9_sent "TG AUX"
lab var jc_l10_kept "TG AUX"
lab var jc_l10_sent "TG AUX"
lab var jc_a1_200 "TG AUX"
lab var jc_a1_400 "TG AUX"
lab var jc_a1_600 "TG AUX"
lab var jc_a1_800 "TG AUX"
lab var jc_a2_200 "TG AUX"
lab var jc_a2_400 "TG AUX"
lab var jc_a2_600 "TG AUX"
lab var jc_a2_800 "TG AUX"
lab var jc_a3_200 "TG AUX"
lab var jc_a3_400 "TG AUX"
lab var jc_a3_600 "TG AUX"
lab var jc_a3_800 "TG AUX"
lab var jc_a4_200 "TG AUX"
lab var jc_a4_400 "TG AUX"
lab var jc_a4_600 "TG AUX"
lab var jc_a4_800 "TG AUX"
lab var jc_a5_200 "TG AUX"
lab var jc_a5_400 "TG AUX"
lab var jc_a5_600 "TG AUX"
lab var jc_a5_800 "TG AUX"

*** PUBLIC GOOD GAME ***

replace jbp_l7_g = . if orange<7
replace jbp_l8_g = . if orange<8
replace jbp_l9_g = . if orange<9
replace jbp_l10_g = . if orange<10

replace jbp_l7_opi = . if orange<7
replace jbp_l8_opi = . if orange<8
replace jbp_l9_opi = . if orange<9
replace jbp_l10_opi = . if orange<10

replace jbp_a4_g   = . if blue<4
replace jbp_a5_g   = . if blue<5

replace jbp_a4_opi   = . if blue<4
replace jbp_a5_opi   = . if blue<5

foreach var in jbp_a1_g jbp_a2_g jbp_a3_g jbp_a4_g jbp_a5_g jbp_a1_opi jbp_a2_opi jbp_a3_opi jbp_a4_opi jbp_a5_opi{
replace `var' = . if `var'==9
}

forval x=1/10 {
gen pgg_orange`x' = jbp_l`x'_g
}
forval x=1/10 {
gen pgg_belief_orange`x' = jbp_l`x'_opi
}
forval x=1/5 {
gen pgg_blue`x' = jbp_a`x'_g
}
forval x=1/5 {
gen pgg_belief_blue`x' = jbp_a`x'_opi
}

order pgg_orange1 pgg_orange2 pgg_orange3 pgg_orange4 pgg_orange5 pgg_orange6 pgg_orange7 pgg_orange8 pgg_orange9 pgg_orange10 pgg_belief_orange1 pgg_belief_orange2 pgg_belief_orange3 pgg_belief_orange4 pgg_belief_orange5 pgg_belief_orange6 pgg_belief_orange7 pgg_belief_orange8 pgg_belief_orange9 pgg_belief_orange10 pgg_blue1 pgg_blue2 pgg_blue3 pgg_blue4 pgg_blue5 pgg_belief_blue1 pgg_belief_blue2 pgg_belief_blue3 pgg_belief_blue4 pgg_belief_blue5, after(tg_return800_blue5)

lab var pgg_orange1 "PGG: parent 1 invests in group account"
lab var pgg_orange2 "PGG: parent 2 invests in group account"
lab var pgg_orange3 "PGG: parent 3 invests in group account"
lab var pgg_orange4 "PGG: parent 4 invests in group account"
lab var pgg_orange5 "PGG: parent 5 invests in group account"
lab var pgg_orange6 "PGG: parent 6 invests in group account"
lab var pgg_orange7 "PGG: parent 7 invests in group account"
lab var pgg_orange8 "PGG: parent 8 invests in group account"
lab var pgg_orange9 "PGG: parent 9 invests in group account"
lab var pgg_orange10 "PGG: parent 10 invests in group account"
lab var pgg_belief_orange1 "PGG: parent 1 belief about group account"
lab var pgg_belief_orange2 "PGG: parent 2 belief about group account"
lab var pgg_belief_orange3 "PGG: parent 3 belief about group account"
lab var pgg_belief_orange4 "PGG: parent 4 belief about group account"
lab var pgg_belief_orange5 "PGG: parent 5 belief about group account"
lab var pgg_belief_orange6 "PGG: parent 6 belief about group account"
lab var pgg_belief_orange7 "PGG: parent 7 belief about group account"
lab var pgg_belief_orange8 "PGG: parent 8 belief about group account"
lab var pgg_belief_orange9 "PGG: parent 9 belief about group account"
lab var pgg_belief_orange10 "PGG: parent 10 belief about group account"
lab var pgg_blue1 "PGG: teacher 1 invests in group account"
lab var pgg_blue2 "PGG: teacher 2 invests in group account"
lab var pgg_blue3 "PGG: teacher 3 invests in group account"
lab var pgg_blue4 "PGG: teacher 4 invests in group account"
lab var pgg_blue5 "PGG: teacher 5 invests in group account"
lab var pgg_belief_blue1 "PGG: teacher 1 belief about group account"
lab var pgg_belief_blue2 "PGG: teacher 2 belief about group account"
lab var pgg_belief_blue3 "PGG: teacher 3 belief about group account"
lab var pgg_belief_blue4 "PGG: teacher 4 belief about group account"
lab var pgg_belief_blue5 "PGG: teacher 5 belief about group account"

lab var jbp_l_cartoes "PGG AUX"
lab var jbp_l1_g "PGG AUX"
lab var jbp_l2_g "PGG AUX"
lab var jbp_l3_g "PGG AUX"
lab var jbp_l4_g "PGG AUX"
lab var jbp_l5_g "PGG AUX"
lab var jbp_l6_g "PGG AUX"
lab var jbp_l7_g "PGG AUX"
lab var jbp_l8_g "PGG AUX"
lab var jbp_l9_g "PGG AUX"
lab var jbp_l10_g "PGG AUX"
lab var jbp_l1_opi "PGG AUX"
lab var jbp_l2_opi "PGG AUX"
lab var jbp_l3_opi "PGG AUX"
lab var jbp_l4_opi "PGG AUX"
lab var jbp_l5_opi "PGG AUX"
lab var jbp_l6_opi "PGG AUX"
lab var jbp_l7_opi "PGG AUX"
lab var jbp_l8_opi "PGG AUX"
lab var jbp_l9_opi "PGG AUX"
lab var jbp_l10_opi "PGG AUX"
lab var jbp_a_cartoes "PGG AUX"
lab var jbp_a1_g "PGG AUX"
lab var jbp_a2_g "PGG AUX"
lab var jbp_a3_g "PGG AUX"
lab var jbp_a4_g "PGG AUX"
lab var jbp_a5_g "PGG AUX"
lab var jbp_a1_opi "PGG AUX"
lab var jbp_a2_opi "PGG AUX"
lab var jbp_a3_opi "PGG AUX"
lab var jbp_a4_opi "PGG AUX"
lab var jbp_a5_opi "PGG AUX"

save "$Endline_dtRaw/_intermediate files/games.dta", replace

*** RESHAPING: BLUE (TEACHERS)***

drop jda_a1_kept jda_a1_sent jda_a2_kept jda_a2_sent jda_a3_kept jda_a3_sent jda_a4_kept jda_a4_sent jda_a5_kept jda_a5_sent jdb_a1_kept jdb_a1_sent jdb_a2_kept jdb_a2_sent jdb_a3_kept jdb_a3_sent jdb_a4_kept jdb_a4_sent jdb_a5_kept jdb_a5_sent jdb_a1_opi_0 jdb_a1_opi_500 jdb_a1_opi_1000 jdb_a1_opi_1500 jdb_a1_opi_2000 jdb_a2_opi_0 jdb_a2_opi_500 jdb_a2_opi_1000 jdb_a2_opi_1500 jdb_a2_opi_2000 jdb_a3_opi_0 jdb_a3_opi_500 jdb_a3_opi_1000 jdb_a3_opi_1500 jdb_a3_opi_2000 jdb_a4_opi_0 jdb_a4_opi_500 jdb_a4_opi_1000 jdb_a4_opi_1500 jdb_a4_opi_2000 jdb_a5_opi_0 jdb_a5_opi_500 jdb_a5_opi_1000 jdb_a5_opi_1500 jdb_a5_opi_2000 jdb_l1_0 jdb_l1_500 jdb_l1_1000 jdb_l1_1500 jdb_l1_2000 jdb_l2_0 jdb_l2_500 jdb_l2_1000 jdb_l2_1500 jdb_l2_2000 jdb_l3_0 jdb_l3_500 jdb_l3_1000 jdb_l3_1500 jdb_l3_2000 jdb_l4_0 jdb_l4_500 jdb_l4_1000 jdb_l4_1500 jdb_l4_2000 jdb_l5_0 jdb_l5_500 jdb_l5_1000 jdb_l5_1500 jdb_l5_2000 jdb_l6_0 jdb_l6_500 jdb_l6_1000 jdb_l6_1500 jdb_l6_2000 jdb_l7_0 jdb_l7_500 jdb_l7_1000 jdb_l7_1500 jdb_l7_2000 jdb_l8_0 jdb_l8_500 jdb_l8_1000 jdb_l8_1500 jdb_l8_2000 jdb_l9_0 jdb_l9_500 jdb_l9_1000 jdb_l9_1500 jdb_l9_2000 jdb_l10_0 jdb_l10_500 jdb_l10_1000 jdb_l10_1500 jdb_l10_2000 jdb_l1_opi_0 jdb_l1_opi_500 jdb_l1_opi_1000 jdb_l1_opi_1500 jdb_l1_opi_2000 jdb_l2_opi_0 jdb_l2_opi_500 jdb_l2_opi_1000 jdb_l2_opi_1500 jdb_l2_opi_2000 jdb_l3_opi_0 jdb_l3_opi_500 jdb_l3_opi_1000 jdb_l3_opi_1500 jdb_l3_opi_2000 jdb_l4_opi_0 jdb_l4_opi_500 jdb_l4_opi_1000 jdb_l4_opi_1500 jdb_l4_opi_2000 jdb_l5_opi_0 jdb_l5_opi_500 jdb_l5_opi_1000 jdb_l5_opi_1500 jdb_l5_opi_2000 jdb_l6_opi_0 jdb_l6_opi_500 jdb_l6_opi_1000 jdb_l6_opi_1500 jdb_l6_opi_2000 jdb_l7_opi_0 jdb_l7_opi_500 jdb_l7_opi_1000 jdb_l7_opi_1500 jdb_l7_opi_2000 jdb_l8_opi_0 jdb_l8_opi_500 jdb_l8_opi_1000 jdb_l8_opi_1500 jdb_l8_opi_2000 jdb_l9_opi_0 jdb_l9_opi_500 jdb_l9_opi_1000 jdb_l9_opi_1500 jdb_l9_opi_2000 jdb_l10_opi_0 jdb_l10_opi_500 jdb_l10_opi_1000 jdb_l10_opi_1500 jdb_l10_opi_2000 jdc_a1_kept jdc_a1_sent jdc_a2_kept jdc_a2_sent jdc_a3_kept jdc_a3_sent jdc_a4_kept jdc_a4_sent jdc_a5_kept jdc_a5_sent jdc_a1_opi_0 jdc_a1_opi_500 jdc_a1_opi_1000 jdc_a1_opi_1500 jdc_a1_opi_2000 jdc_a2_opi_0 jdc_a2_opi_500 jdc_a2_opi_1000 jdc_a2_opi_1500 jdc_a2_opi_2000 jdc_a3_opi_0 jdc_a3_opi_500 jdc_a3_opi_1000 jdc_a3_opi_1500 jdc_a3_opi_2000 jdc_a4_opi_0 jdc_a4_opi_500 jdc_a4_opi_1000 jdc_a4_opi_1500 jdc_a4_opi_2000 jdc_a5_opi_0 jdc_a5_opi_500 jdc_a5_opi_1000 jdc_a5_opi_1500 jdc_a5_opi_2000 jdc_l1_0 jdc_l1_500 jdc_l1_1000 jdc_l1_1500 jdc_l1_2000 jdc_l2_0 jdc_l2_500 jdc_l2_1000 jdc_l2_1500 jdc_l2_2000 jdc_l3_0 jdc_l3_500 jdc_l3_1000 jdc_l3_1500 jdc_l3_2000 jdc_l4_0 jdc_l4_500 jdc_l4_1000 jdc_l4_1500 jdc_l4_2000 jdc_l5_0 jdc_l5_500 jdc_l5_1000 jdc_l5_1500 jdc_l5_2000 jdc_l6_0 jdc_l6_500 jdc_l6_1000 jdc_l6_1500 jdc_l6_2000 jdc_l7_0 jdc_l7_500 jdc_l7_1000 jdc_l7_1500 jdc_l7_2000 jdc_l8_0 jdc_l8_500 jdc_l8_1000 jdc_l8_1500 jdc_l8_2000 jdc_l9_0 jdc_l9_500 jdc_l9_1000 jdc_l9_1500 jdc_l9_2000 jdc_l10_0 jdc_l10_500 jdc_l10_1000 jdc_l10_1500 jdc_l10_2000 jdc_l1_opi_0 jdc_l1_opi_500 jdc_l1_opi_1000 jdc_l1_opi_1500 jdc_l1_opi_2000 jdc_l2_opi_0 jdc_l2_opi_500 jdc_l2_opi_1000 jdc_l2_opi_1500 jdc_l2_opi_2000 jdc_l3_opi_0 jdc_l3_opi_500 jdc_l3_opi_1000 jdc_l3_opi_1500 jdc_l3_opi_2000 jdc_l4_opi_0 jdc_l4_opi_500 jdc_l4_opi_1000 jdc_l4_opi_1500 jdc_l4_opi_2000 jdc_l5_opi_0 jdc_l5_opi_500 jdc_l5_opi_1000 jdc_l5_opi_1500 jdc_l5_opi_2000 jdc_l6_opi_0 jdc_l6_opi_500 jdc_l6_opi_1000 jdc_l6_opi_1500 jdc_l6_opi_2000 jdc_l7_opi_0 jdc_l7_opi_500 jdc_l7_opi_1000 jdc_l7_opi_1500 jdc_l7_opi_2000 jdc_l8_opi_0 jdc_l8_opi_500 jdc_l8_opi_1000 jdc_l8_opi_1500 jdc_l8_opi_2000 jdc_l9_opi_0 jdc_l9_opi_500 jdc_l9_opi_1000 jdc_l9_opi_1500 jdc_l9_opi_2000 jdc_l10_opi_0 jdc_l10_opi_500 jdc_l10_opi_1000 jdc_l10_opi_1500 jdc_l10_opi_2000 jc_l1_kept jc_l1_sent jc_l2_kept jc_l2_sent jc_l3_kept jc_l3_sent jc_l4_kept jc_l4_sent jc_l5_kept jc_l5_sent jc_l6_kept jc_l6_sent jc_l7_kept jc_l7_sent jc_l8_kept jc_l8_sent jc_l9_kept jc_l9_sent jc_l10_kept jc_l10_sent jc_a1_200 jc_a1_400 jc_a1_600 jc_a1_800 jc_a2_200 jc_a2_400 jc_a2_600 jc_a2_800 jc_a3_200 jc_a3_400 jc_a3_600 jc_a3_800 jc_a4_200 jc_a4_400 jc_a4_600 jc_a4_800 jc_a5_200 jc_a5_400 jc_a5_600 jc_a5_800 jbp_l_cartoes jbp_l1_g jbp_l2_g jbp_l3_g jbp_l4_g jbp_l5_g jbp_l6_g jbp_l7_g jbp_l8_g jbp_l9_g jbp_l10_g jbp_l1_opi jbp_l2_opi jbp_l3_opi jbp_l4_opi jbp_l5_opi jbp_l6_opi jbp_l7_opi jbp_l8_opi jbp_l9_opi jbp_l10_opi jbp_a_cartoes jbp_a1_g jbp_a2_g jbp_a3_g jbp_a4_g jbp_a5_g jbp_a1_opi jbp_a2_opi jbp_a3_opi jbp_a4_opi jbp_a5_opi
drop dg_bluemean dg_belief0_bluemean dg_belief500_bluemean dg_belief1000_bluemean dg_belief1500_bluemean dg_belief2000_bluemean
drop dgb_faces0_orange1 dgb_faces0_orange2 dgb_faces0_orange3 dgb_faces0_orange4 dgb_faces0_orange5 dgb_faces0_orange6 dgb_faces0_orange7 dgb_faces0_orange8 dgb_faces0_orange9 dgb_faces0_orange10 dgb_faces500_orange1 dgb_faces500_orange2 dgb_faces500_orange3 dgb_faces500_orange4 dgb_faces500_orange5 dgb_faces500_orange6 dgb_faces500_orange7 dgb_faces500_orange8 dgb_faces500_orange9 dgb_faces500_orange10 dgb_faces1000_orange1 dgb_faces1000_orange2 dgb_faces1000_orange3 dgb_faces1000_orange4 dgb_faces1000_orange5 dgb_faces1000_orange6 dgb_faces1000_orange7 dgb_faces1000_orange8 dgb_faces1000_orange9 dgb_faces1000_orange10 dgb_faces1500_orange1 dgb_faces1500_orange2 dgb_faces1500_orange3 dgb_faces1500_orange4 dgb_faces1500_orange5 dgb_faces1500_orange6 dgb_faces1500_orange7 dgb_faces1500_orange8 dgb_faces1500_orange9 dgb_faces1500_orange10 dgb_faces2000_orange1 dgb_faces2000_orange2 dgb_faces2000_orange3 dgb_faces2000_orange4 dgb_faces2000_orange5 dgb_faces2000_orange6 dgb_faces2000_orange7 dgb_faces2000_orange8 dgb_faces2000_orange9 dgb_faces2000_orange10 dgb_belief0_orange1 dgb_belief0_orange2 dgb_belief0_orange3 dgb_belief0_orange4 dgb_belief0_orange5 dgb_belief0_orange6 dgb_belief0_orange7 dgb_belief0_orange8 dgb_belief0_orange9 dgb_belief0_orange10 dgb_belief500_orange1 dgb_belief500_orange2 dgb_belief500_orange3 dgb_belief500_orange4 dgb_belief500_orange5 dgb_belief500_orange6 dgb_belief500_orange7 dgb_belief500_orange8 dgb_belief500_orange9 dgb_belief500_orange10 dgb_belief1000_orange1 dgb_belief1000_orange2 dgb_belief1000_orange3 dgb_belief1000_orange4 dgb_belief1000_orange5 dgb_belief1000_orange6 dgb_belief1000_orange7 dgb_belief1000_orange8 dgb_belief1000_orange9 dgb_belief1000_orange10 dgb_belief1500_orange1 dgb_belief1500_orange2 dgb_belief1500_orange3 dgb_belief1500_orange4 dgb_belief1500_orange5 dgb_belief1500_orange6 dgb_belief1500_orange7 dgb_belief1500_orange8 dgb_belief1500_orange9 dgb_belief1500_orange10 dgb_belief2000_orange1 dgb_belief2000_orange2 dgb_belief2000_orange3 dgb_belief2000_orange4 dgb_belief2000_orange5 dgb_belief2000_orange6 dgb_belief2000_orange7 dgb_belief2000_orange8 dgb_belief2000_orange9 dgb_belief2000_orange10 dgc_faces0_orange1 dgc_faces0_orange2 dgc_faces0_orange3 dgc_faces0_orange4 dgc_faces0_orange5 dgc_faces0_orange6 dgc_faces0_orange7 dgc_faces0_orange8 dgc_faces0_orange9 dgc_faces0_orange10 dgc_faces500_orange1 dgc_faces500_orange2 dgc_faces500_orange3 dgc_faces500_orange4 dgc_faces500_orange5 dgc_faces500_orange6 dgc_faces500_orange7 dgc_faces500_orange8 dgc_faces500_orange9 dgc_faces500_orange10 dgc_faces1000_orange1 dgc_faces1000_orange2 dgc_faces1000_orange3 dgc_faces1000_orange4 dgc_faces1000_orange5 dgc_faces1000_orange6 dgc_faces1000_orange7 dgc_faces1000_orange8 dgc_faces1000_orange9 dgc_faces1000_orange10 dgc_faces1500_orange1 dgc_faces1500_orange2 dgc_faces1500_orange3 dgc_faces1500_orange4 dgc_faces1500_orange5 dgc_faces1500_orange6 dgc_faces1500_orange7 dgc_faces1500_orange8 dgc_faces1500_orange9 dgc_faces1500_orange10 dgc_faces2000_orange1 dgc_faces2000_orange2 dgc_faces2000_orange3 dgc_faces2000_orange4 dgc_faces2000_orange5 dgc_faces2000_orange6 dgc_faces2000_orange7 dgc_faces2000_orange8 dgc_faces2000_orange9 dgc_faces2000_orange10 dgc_belief0_orange1 dgc_belief0_orange2 dgc_belief0_orange3 dgc_belief0_orange4 dgc_belief0_orange5 dgc_belief0_orange6 dgc_belief0_orange7 dgc_belief0_orange8 dgc_belief0_orange9 dgc_belief0_orange10 dgc_belief500_orange1 dgc_belief500_orange2 dgc_belief500_orange3 dgc_belief500_orange4 dgc_belief500_orange5 dgc_belief500_orange6 dgc_belief500_orange7 dgc_belief500_orange8 dgc_belief500_orange9 dgc_belief500_orange10 dgc_belief1000_orange1 dgc_belief1000_orange2 dgc_belief1000_orange3 dgc_belief1000_orange4 dgc_belief1000_orange5 dgc_belief1000_orange6 dgc_belief1000_orange7 dgc_belief1000_orange8 dgc_belief1000_orange9 dgc_belief1000_orange10 dgc_belief1500_orange1 dgc_belief1500_orange2 dgc_belief1500_orange3 dgc_belief1500_orange4 dgc_belief1500_orange5 dgc_belief1500_orange6 dgc_belief1500_orange7 dgc_belief1500_orange8 dgc_belief1500_orange9 dgc_belief1500_orange10 dgc_belief2000_orange1 dgc_belief2000_orange2 dgc_belief2000_orange3 dgc_belief2000_orange4 dgc_belief2000_orange5 dgc_belief2000_orange6 dgc_belief2000_orange7 dgc_belief2000_orange8 dgc_belief2000_orange9 dgc_belief2000_orange10 dgb_faces0_orangemean dgb_faces500_orangemean dgb_faces1000_orangemean dgb_faces1500_orangemean dgb_faces2000_orangemean dgb_faces0_orangemean_i dgb_faces500_orangemean_i dgb_faces1000_orangemean_i dgb_faces1500_orangemean_i dgb_faces2000_orangemean_i dgc_faces0_orangemean dgc_faces500_orangemean dgc_faces1000_orangemean dgc_faces1500_orangemean dgc_faces2000_orangemean tg_orange1 tg_orange2 tg_orange3 tg_orange4 tg_orange5 tg_orange6 tg_orange7 tg_orange8 tg_orange9 tg_orange10 pgg_orange1 pgg_orange2 pgg_orange3 pgg_orange4 pgg_orange5 pgg_orange6 pgg_orange7 pgg_orange8 pgg_orange9 pgg_orange10 pgg_belief_orange1 pgg_belief_orange2 pgg_belief_orange3 pgg_belief_orange4 pgg_belief_orange5 pgg_belief_orange6 pgg_belief_orange7 pgg_belief_orange8 pgg_belief_orange9 pgg_belief_orange10

reshape long dg_blue dg_belief0_blue dg_belief500_blue dg_belief1000_blue dg_belief1500_blue dg_belief2000_blue tg_return200_blue tg_return400_blue tg_return600_blue tg_return800_blue pgg_blue pgg_belief_blue, i(school_id) j(blue_id)

lab var blue_id "ID blue participant (teacher)"

rename *_blue *

lab var dg 					"DG: sent"
lab var dg_belief0  		"DG: belief about faces bought if sent 0"
lab var dg_belief500  		"DG: belief about faces bought if sent 500"
lab var dg_belief1000  		"DG: belief about faces bought if sent 1000"
lab var dg_belief1500  		"DG: belief about faces bought if sent 1500"
lab var dg_belief2000  		"DG: belief about faces bought if sent 2000"
lab var tg_return200  		"TG: return if sent 200"
lab var tg_return400  		"TG: return if sent 400"
lab var tg_return600  		"TG: return if sent 600"
lab var tg_return800  		"TG: return if sent 800"
lab var pgg  				"PGG: group investment"
lab var pgg_belief  		"PGG: belief about group investment"

save "$Endline_dtRaw/_intermediate files/games_teachers.dta", replace

*** RESHAPING: ORANGE (PARENTS) ***

use "$Endline_dtRaw/_intermediate files/games.dta", clear

drop jda_a1_kept jda_a1_sent jda_a2_kept jda_a2_sent jda_a3_kept jda_a3_sent jda_a4_kept jda_a4_sent jda_a5_kept jda_a5_sent jdb_a1_kept jdb_a1_sent jdb_a2_kept jdb_a2_sent jdb_a3_kept jdb_a3_sent jdb_a4_kept jdb_a4_sent jdb_a5_kept jdb_a5_sent jdb_a1_opi_0 jdb_a1_opi_500 jdb_a1_opi_1000 jdb_a1_opi_1500 jdb_a1_opi_2000 jdb_a2_opi_0 jdb_a2_opi_500 jdb_a2_opi_1000 jdb_a2_opi_1500 jdb_a2_opi_2000 jdb_a3_opi_0 jdb_a3_opi_500 jdb_a3_opi_1000 jdb_a3_opi_1500 jdb_a3_opi_2000 jdb_a4_opi_0 jdb_a4_opi_500 jdb_a4_opi_1000 jdb_a4_opi_1500 jdb_a4_opi_2000 jdb_a5_opi_0 jdb_a5_opi_500 jdb_a5_opi_1000 jdb_a5_opi_1500 jdb_a5_opi_2000 jdb_l1_0 jdb_l1_500 jdb_l1_1000 jdb_l1_1500 jdb_l1_2000 jdb_l2_0 jdb_l2_500 jdb_l2_1000 jdb_l2_1500 jdb_l2_2000 jdb_l3_0 jdb_l3_500 jdb_l3_1000 jdb_l3_1500 jdb_l3_2000 jdb_l4_0 jdb_l4_500 jdb_l4_1000 jdb_l4_1500 jdb_l4_2000 jdb_l5_0 jdb_l5_500 jdb_l5_1000 jdb_l5_1500 jdb_l5_2000 jdb_l6_0 jdb_l6_500 jdb_l6_1000 jdb_l6_1500 jdb_l6_2000 jdb_l7_0 jdb_l7_500 jdb_l7_1000 jdb_l7_1500 jdb_l7_2000 jdb_l8_0 jdb_l8_500 jdb_l8_1000 jdb_l8_1500 jdb_l8_2000 jdb_l9_0 jdb_l9_500 jdb_l9_1000 jdb_l9_1500 jdb_l9_2000 jdb_l10_0 jdb_l10_500 jdb_l10_1000 jdb_l10_1500 jdb_l10_2000 jdb_l1_opi_0 jdb_l1_opi_500 jdb_l1_opi_1000 jdb_l1_opi_1500 jdb_l1_opi_2000 jdb_l2_opi_0 jdb_l2_opi_500 jdb_l2_opi_1000 jdb_l2_opi_1500 jdb_l2_opi_2000 jdb_l3_opi_0 jdb_l3_opi_500 jdb_l3_opi_1000 jdb_l3_opi_1500 jdb_l3_opi_2000 jdb_l4_opi_0 jdb_l4_opi_500 jdb_l4_opi_1000 jdb_l4_opi_1500 jdb_l4_opi_2000 jdb_l5_opi_0 jdb_l5_opi_500 jdb_l5_opi_1000 jdb_l5_opi_1500 jdb_l5_opi_2000 jdb_l6_opi_0 jdb_l6_opi_500 jdb_l6_opi_1000 jdb_l6_opi_1500 jdb_l6_opi_2000 jdb_l7_opi_0 jdb_l7_opi_500 jdb_l7_opi_1000 jdb_l7_opi_1500 jdb_l7_opi_2000 jdb_l8_opi_0 jdb_l8_opi_500 jdb_l8_opi_1000 jdb_l8_opi_1500 jdb_l8_opi_2000 jdb_l9_opi_0 jdb_l9_opi_500 jdb_l9_opi_1000 jdb_l9_opi_1500 jdb_l9_opi_2000 jdb_l10_opi_0 jdb_l10_opi_500 jdb_l10_opi_1000 jdb_l10_opi_1500 jdb_l10_opi_2000 jdc_a1_kept jdc_a1_sent jdc_a2_kept jdc_a2_sent jdc_a3_kept jdc_a3_sent jdc_a4_kept jdc_a4_sent jdc_a5_kept jdc_a5_sent jdc_a1_opi_0 jdc_a1_opi_500 jdc_a1_opi_1000 jdc_a1_opi_1500 jdc_a1_opi_2000 jdc_a2_opi_0 jdc_a2_opi_500 jdc_a2_opi_1000 jdc_a2_opi_1500 jdc_a2_opi_2000 jdc_a3_opi_0 jdc_a3_opi_500 jdc_a3_opi_1000 jdc_a3_opi_1500 jdc_a3_opi_2000 jdc_a4_opi_0 jdc_a4_opi_500 jdc_a4_opi_1000 jdc_a4_opi_1500 jdc_a4_opi_2000 jdc_a5_opi_0 jdc_a5_opi_500 jdc_a5_opi_1000 jdc_a5_opi_1500 jdc_a5_opi_2000 jdc_l1_0 jdc_l1_500 jdc_l1_1000 jdc_l1_1500 jdc_l1_2000 jdc_l2_0 jdc_l2_500 jdc_l2_1000 jdc_l2_1500 jdc_l2_2000 jdc_l3_0 jdc_l3_500 jdc_l3_1000 jdc_l3_1500 jdc_l3_2000 jdc_l4_0 jdc_l4_500 jdc_l4_1000 jdc_l4_1500 jdc_l4_2000 jdc_l5_0 jdc_l5_500 jdc_l5_1000 jdc_l5_1500 jdc_l5_2000 jdc_l6_0 jdc_l6_500 jdc_l6_1000 jdc_l6_1500 jdc_l6_2000 jdc_l7_0 jdc_l7_500 jdc_l7_1000 jdc_l7_1500 jdc_l7_2000 jdc_l8_0 jdc_l8_500 jdc_l8_1000 jdc_l8_1500 jdc_l8_2000 jdc_l9_0 jdc_l9_500 jdc_l9_1000 jdc_l9_1500 jdc_l9_2000 jdc_l10_0 jdc_l10_500 jdc_l10_1000 jdc_l10_1500 jdc_l10_2000 jdc_l1_opi_0 jdc_l1_opi_500 jdc_l1_opi_1000 jdc_l1_opi_1500 jdc_l1_opi_2000 jdc_l2_opi_0 jdc_l2_opi_500 jdc_l2_opi_1000 jdc_l2_opi_1500 jdc_l2_opi_2000 jdc_l3_opi_0 jdc_l3_opi_500 jdc_l3_opi_1000 jdc_l3_opi_1500 jdc_l3_opi_2000 jdc_l4_opi_0 jdc_l4_opi_500 jdc_l4_opi_1000 jdc_l4_opi_1500 jdc_l4_opi_2000 jdc_l5_opi_0 jdc_l5_opi_500 jdc_l5_opi_1000 jdc_l5_opi_1500 jdc_l5_opi_2000 jdc_l6_opi_0 jdc_l6_opi_500 jdc_l6_opi_1000 jdc_l6_opi_1500 jdc_l6_opi_2000 jdc_l7_opi_0 jdc_l7_opi_500 jdc_l7_opi_1000 jdc_l7_opi_1500 jdc_l7_opi_2000 jdc_l8_opi_0 jdc_l8_opi_500 jdc_l8_opi_1000 jdc_l8_opi_1500 jdc_l8_opi_2000 jdc_l9_opi_0 jdc_l9_opi_500 jdc_l9_opi_1000 jdc_l9_opi_1500 jdc_l9_opi_2000 jdc_l10_opi_0 jdc_l10_opi_500 jdc_l10_opi_1000 jdc_l10_opi_1500 jdc_l10_opi_2000 jc_l1_kept jc_l1_sent jc_l2_kept jc_l2_sent jc_l3_kept jc_l3_sent jc_l4_kept jc_l4_sent jc_l5_kept jc_l5_sent jc_l6_kept jc_l6_sent jc_l7_kept jc_l7_sent jc_l8_kept jc_l8_sent jc_l9_kept jc_l9_sent jc_l10_kept jc_l10_sent jc_a1_200 jc_a1_400 jc_a1_600 jc_a1_800 jc_a2_200 jc_a2_400 jc_a2_600 jc_a2_800 jc_a3_200 jc_a3_400 jc_a3_600 jc_a3_800 jc_a4_200 jc_a4_400 jc_a4_600 jc_a4_800 jc_a5_200 jc_a5_400 jc_a5_600 jc_a5_800 jbp_l_cartoes jbp_l1_g jbp_l2_g jbp_l3_g jbp_l4_g jbp_l5_g jbp_l6_g jbp_l7_g jbp_l8_g jbp_l9_g jbp_l10_g jbp_l1_opi jbp_l2_opi jbp_l3_opi jbp_l4_opi jbp_l5_opi jbp_l6_opi jbp_l7_opi jbp_l8_opi jbp_l9_opi jbp_l10_opi jbp_a_cartoes jbp_a1_g jbp_a2_g jbp_a3_g jbp_a4_g jbp_a5_g jbp_a1_opi jbp_a2_opi jbp_a3_opi jbp_a4_opi jbp_a5_opi
drop dg_blue1 dg_blue2 dg_blue3 dg_blue4 dg_blue5 dg_bluemean dg_belief0_blue1 dg_belief0_blue2 dg_belief0_blue3 dg_belief0_blue4 dg_belief0_blue5 dg_belief0_bluemean dg_belief500_blue1 dg_belief500_blue2 dg_belief500_blue3 dg_belief500_blue4 dg_belief500_blue5 dg_belief500_bluemean dg_belief1000_blue1 dg_belief1000_blue2 dg_belief1000_blue3 dg_belief1000_blue4 dg_belief1000_blue5 dg_belief1000_bluemean dg_belief1500_blue1 dg_belief1500_blue2 dg_belief1500_blue3 dg_belief1500_blue4 dg_belief1500_blue5 dg_belief1500_bluemean dg_belief2000_blue1 dg_belief2000_blue2 dg_belief2000_blue3 dg_belief2000_blue4 dg_belief2000_blue5 dg_belief2000_bluemean tg_return200_blue1 tg_return200_blue2 tg_return200_blue3 tg_return200_blue4 tg_return200_blue5 tg_return400_blue1 tg_return400_blue2 tg_return400_blue3 tg_return400_blue4 tg_return400_blue5 tg_return600_blue1 tg_return600_blue2 tg_return600_blue3 tg_return600_blue4 tg_return600_blue5 tg_return800_blue1 tg_return800_blue2 tg_return800_blue3 tg_return800_blue4 tg_return800_blue5 pgg_blue1 pgg_blue2 pgg_blue3 pgg_blue4 pgg_blue5 pgg_belief_blue1 pgg_belief_blue2 pgg_belief_blue3 pgg_belief_blue4 pgg_belief_blue5
drop dgb_faces0_orangemean dgb_faces500_orangemean dgb_faces1000_orangemean dgb_faces1500_orangemean dgb_faces2000_orangemean dgb_faces0_orangemean_i dgb_faces500_orangemean_i dgb_faces1000_orangemean_i dgb_faces1500_orangemean_i dgb_faces2000_orangemean_i dgc_faces0_orangemean dgc_faces500_orangemean dgc_faces1000_orangemean dgc_faces1500_orangemean dgc_faces2000_orangemean

reshape long dgb_faces0_orange dgb_faces500_orange dgb_faces1000_orange dgb_faces1500_orange dgb_faces2000_orange dgb_belief0_orange dgb_belief500_orange dgb_belief1000_orange dgb_belief1500_orange dgb_belief2000_orange dgc_faces0_orange dgc_faces500_orange dgc_faces1000_orange dgc_faces1500_orange dgc_faces2000_orange dgc_belief0_orange dgc_belief500_orange dgc_belief1000_orange dgc_belief1500_orange dgc_belief2000_orange tg_orange pgg_orange pgg_belief_orange, i(school_id) j(orange_id)

lab var orange_id "ID orange participant (parent)"

rename *_orange *

lab var dgb_faces0 			"DG: representative decision if received 0"
lab var dgb_faces500 		"DG: representative decision if received 500"
lab var dgb_faces1000 		"DG: representative decision if received 1000"
lab var dgb_faces1500 		"DG: representative decision if received 1500"
lab var dgb_faces2000 		"DG: representative decision if received 2000"
lab var dgb_belief0 		"DG: belief about representative decision if received 0"
lab var dgb_belief500 		"DG: belief about representative decision if received 500"
lab var dgb_belief1000 		"DG: belief about representative decision if received 1000"
lab var dgb_belief1500 		"DG: belief about representative decision if received 1500"
lab var dgb_belief2000 		"DG: belief about representative decision if received 2000"
lab var dgc_faces0 			"DG: faces bought if received 0"
lab var dgc_faces500 		"DG: faces bought if received 500"
lab var dgc_faces1000 		"DG: faces bought if received 1000"
lab var dgc_faces1500 		"DG: faces bought if received 1500"
lab var dgc_faces2000 		"DG: faces bought if received 2000"
lab var dgc_belief0 		"DG: belief about faces bought if received 0"
lab var dgc_belief500 		"DG: belief about faces bought if received 500"
lab var dgc_belief1000 		"DG: belief about faces bought if received 1000"
lab var dgc_belief1500 		"DG: belief about faces bought if received 1500"
lab var dgc_belief2000 		"DG: belief about faces bought if received 2000"
lab var tg 					"TG: sent"
lab var pgg 				"PGG: group investment"
lab var pgg_belief 			"PGG: belief about group investment"

save "$Endline_dtRaw/_intermediate files/games_parents.dta", replace


*** ADD registration data ***

use "$Endline_dtRaw/games/games_reg_data5.dta", clear

label drop _all



rename data_dia 			date
rename data_mes 			month
rename escola_nome			school_name
rename lider_sala_1_id 		leader1
rename lider_1_sala_2_id 	leader2_1
rename lider_2_sala_2_id 	leader2_2

lab var school_id 	"ID school"
lab var school_name	"Name school"
lab var date 		"Day of game"
lab var month 		"Month of game"
lab var leader1 	"ID leader room 1"
lab var leader2_1 	"ID first leader room 2"
lab var leader2_2 	"ID second leader room 2"

destring school_id, replace

drop if school_id==.

order month,after(date)

lab var teacher1 "Name teacher 1"
lab var teacher2 "Name teacher 2"
lab var teacher3 "Name teacher 3"
lab var teacher4 "Name teacher 4"
lab var teacher5 "Name teacher 5"

lab var parent1 "Name parent 1"
lab var parent2 "Name parent 2"
lab var parent3 "Name parent 3"
lab var parent4 "Name parent 4"
lab var parent5 "Name parent 5"
lab var parent6 "Name parent 6"
lab var parent7 "Name parent 7"
lab var parent8 "Name parent 8"
lab var parent9 "Name parent 9"
lab var parent10 "Name parent 10"

rename teacher* name_teacher*
rename parent* name_parent*

destring q_p1 q_p2 q_p3 q_p4 q_p5 q_t1 q_t2 q_t3 q_t4 q_t5 q_t6 q_t7 q_t8 q_t9 q_t10, replace
destring badge_p1 badge_p2 badge_p3 badge_p4 badge_p5 badge_t1 badge_t2 badge_t3 badge_t4 badge_t5 badge_t6 badge_t7 badge_t8 badge_t9 badge_t10, replace

rename q_p* id_teacher*
rename q_t* id_parent*

rename badge_p* game_id_teacher*
rename badge_t* game_id_parent*

lab var id_teacher1  "Questionnaire ID"
lab var id_teacher2  "Questionnaire ID"
lab var id_teacher3  "Questionnaire ID"
lab var id_teacher4  "Questionnaire ID"
lab var id_teacher5  "Questionnaire ID"
lab var game_id_teacher1 "Game ID"
lab var game_id_teacher2 "Game ID"
lab var game_id_teacher3 "Game ID"
lab var game_id_teacher4 "Game ID"
lab var game_id_teacher5 "Game ID"
lab var id_parent1 "Questionnair ID"
lab var id_parent2 "Questionnair ID"
lab var id_parent3 "Questionnair ID"
lab var id_parent4 "Questionnair ID"
lab var id_parent5 "Questionnair ID"
lab var id_parent6 "Questionnair ID"
lab var id_parent7 "Questionnair ID"
lab var id_parent8 "Questionnair ID"
lab var id_parent9 "Questionnair ID"
lab var id_parent10 "Questionnair ID"
lab var game_id_parent1 "Game ID"
lab var game_id_parent2 "Game ID"
lab var game_id_parent3 "Game ID"
lab var game_id_parent4 "Game ID"
lab var game_id_parent5 "Game ID"
lab var game_id_parent6 "Game ID"
lab var game_id_parent7 "Game ID"
lab var game_id_parent8 "Game ID"
lab var game_id_parent9 "Game ID"
lab var game_id_parent10 "Game ID"

foreach var in name_teacher4 name_teacher5 name_parent7 name_parent8 name_parent9 name_parent10{
replace `var' = "" if `var'=="99                            "
replace `var' = "" if `var'=="999                           "
replace `var' = "" if `var'=="                              "
}

foreach var in id_teacher1 game_id_teacher1 id_teacher2 game_id_teacher2 id_teacher3 game_id_teacher3 id_teacher4 game_id_teacher4 id_teacher5 game_id_teacher5 id_parent1 game_id_parent1 id_parent2 game_id_parent2 id_parent3 game_id_parent3 id_parent4 game_id_parent4 id_parent5 game_id_parent5 id_parent6 game_id_parent6 id_parent7 game_id_parent7 id_parent8 game_id_parent8 id_parent9 game_id_parent9 id_parent10 game_id_parent10{
replace `var' = . if `var'==99
}


forval x=4/5{
replace id_teacher`x' = . if name_teacher`x'==""
replace game_id_teacher`x' = . if name_teacher`x'==""
}

forval x=7/10{
replace id_parent`x' = . if name_parent`x'==""
replace game_id_parent`x' = . if name_parent`x'==""
}
replace name_parent9 = "Not selected" if school_id==118
replace id_parent9 = . if school_id==118
replace game_id_parent9 = 9 if school_id==118

replace name_parent7 = "Not selected" if school_id==18
replace id_parent7 = . if school_id==18
replace game_id_parent7 = 7 if school_id==18

replace name_parent7 = "Jose Francisco" if school_id==103
replace id_parent7 = 22 if school_id==103
replace game_id_parent7 = 7 if school_id==103


replace name_parent6 = name_parent7 if school_id==112
replace name_parent7 = name_parent8 if school_id==112
replace name_parent8 = name_parent9 if school_id==112
replace name_parent9 = name_parent10 if school_id==112
replace name_parent10 = "" if school_id==112

replace id_parent6 = id_parent7 if school_id==112
replace id_parent7 = id_parent8 if school_id==112
replace id_parent8 = id_parent9 if school_id==112
replace id_parent9 = id_parent10 if school_id==112
replace id_parent10 = . if school_id==112

save "$Endline_dtRaw/_intermediate files/games_register.dta", replace


** teachers

reshape long name_teacher id_teacher game_id_teacher, i(school_id) j(teacher)

drop if game_id_teacher==.

lab var teacher "registration form sequence"

lab var name_teacher 		"Name teacher"
lab var id_teacher 			"Questionnaire ID teacher"
lab var game_id_teacher		"Game ID teacher"

keep school_id teacher school_name date month leader1 leader2_1 leader2_2 name_teacher id_teacher game_id_teacher

recode  game_id_teacher (2=1) (3=2) (4=3) (5=4) if school_id==124

gen id= (school_id*100)+game_id_teacher

rename * r_*

rename r_id id

save "$Endline_dtRaw/_intermediate files/games_register_teachers.dta", replace


use "$Endline_dtRaw/_intermediate files/games_teachers.dta", clear

gen id = (school_id*100)+blue_id

merge 1:1 id using "$Endline_dtRaw/_intermediate files/games_register_teachers.dta"

****** this should not be necessary anymore when all is solved:

keep if _merge==3

******

drop _merge
drop if r_id_teacher==.

replace leader2_1 = . if leader2_1==88
replace leader2_2 = . if leader2_2==88

#delimit ;
;
label define enum
1	"Antonio Lopes Miguel Rocha"
2	"Augusta Júlio Miranda"
3	"César Zau Joaquim Morais Mendes"
4	"Edesdeth Abrantes Fonseca"
5	"Fernando Portugal Leonardo"
6	"Filipe Quissana Cariengue"
7	"Herlander Mauro Lemos Lima"
8	"Manuel Aguinaldo Barroso Moreira Francisco"
9	"Albertina de Oliveira Armando"
10	"Augusto Viana Kupinga"
11	"Beatriz Laurinda Teixeira da Costa"
12	"Carlos da Fonseca Ricardo "
13	"Carolina Germano da Silva"
14	"Felizarda Luis Avelino"
15	"Hermínia Caetano Kalolo"
16	"Ilídio Duarte Reis Cardoso"
17	"Isabel Marcolino Lisboa"
18	"João Monteiro Bimbe"
19	"José Alberto Nungulo Kamucunja"
20	"Manuel Pinheiro Inacio Ernesto"
21	"Marimilia Francisco Fernando"
22	"José Bambi Kandjeke"
23	"Samora Paulo José Ganga"
24	"Victória Maneco Tavares"
25	"Adelaide Fernando Miguens"
26	"Adelaide Marcelina da Cruz Zeferino"
27	"Adilson Fragoso Pascoal Inácio Filipe"
28	"Amaro Alberto Chipa"
29	"Ana Paula Silvestre Ventura"
30	"Antonio Calei Pedro da Silva"
31	"António Manuel da Silva"
32	"Bernardo Miguêns Gimbo"
33	"Bernardo Sungo Manuel Zau"
34	"Bráulio Eanes Gabriel Alberto"
35	"Bruno José Fernando Viegas"
36	"Carvalinho António Correia"
37	"Cirineu Jr. Jorge"
38	"Domingos Guimarães Sumano"
39	"Elvino António Sobral Salomão"
40	"Etelvina Albertina Francisco Teixeira"
41	"Helder Silvestre Lino Tomé Pinto"
42	"Joana Pinto Soma"
43	"Jonas Frederico Albino Rangel"
44	"José Catraio António"
45	"José Luciano Januário"
46	"José Maria Sumano Delgado"
47	"José Pinto Fançony"
48	"Magalhães Salissinga Gomes"
49	"Maria de Fátima Paulo Feliciano"
50	"Mariza Fernando Manuel Vales"
51	"Monteiro Bastos"
52	"Nilton Januário Valentim"
53	"Sara Claúdio Vidro Aguiar Maneco"
54	"Telma da Conceição Mweleyavo António"
55	"Teresa Aguiar da Costa"
56	"Teresa Kizua Kassucada"
57	"Bruno Avelino Segunda"
58	"Inocêncio Mário Cupenala"
59	"Sabino Jorge Bira"
;
label define version
1	"A: no reciprocity"
2	"B: representative decision"
3	"C: individual decision"
;
#delimit cr

lab val leader1 leader2_1 leader2_2 enum
lab val version version

replace pgg_belief = . if pgg_belief==5 & blue==1

drop id r_school_id r_teacher r_leader1 r_game_id_teacher

order r_school_name, after(school_id)
order r_name_teacher r_id_teacher, after(blue_id)

rename r_school_name school_name
rename r_name_teacher teacher_name
rename r_id_teacher teacher_id

order r_date r_month, after(month)
order r_leader2_1 r_leader2_2, after(leader2_2)

order blue orange, after(r_leader2_2)

replace orange = 8 if school_id==118

replace teacher_id = 2 if blue_id==2 & school_id==23


***********

gen municipality = .
replace municipality = 1 if inlist(school_id,1,2,3,4,5,6,7,8,9,10,12,13,14,15,16,17,18,19,20,21,22,24,25,26,27,28,29,30,31,32,33,34,35,37,40,45,61,86,110)
replace municipality = 2 if inlist(school_id,23,43,44,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,62,63,64,65,66,67,68,69,70,71,72,73,75,76,77,78,79,80,81)
replace municipality = 3 if inlist(school_id,11,36,38,39,41,42,74,82,83,84,85,87,88,89,90,91,92,93,94,95,96,97,98,99,101,102,103,104,105)
replace municipality = 4 if inlist(school_id,118,119,120,121,122,123,124,125)
replace municipality = 5 if inlist(school_id,100,112,113,114,115,116,117)
replace municipality = 6 if inlist(school_id,109,111)
replace municipality = 7 if inlist(school_id,106,107)
replace municipality = 8 if inlist(school_id,126)
replace municipality = 9 if inlist(school_id,108)


gen treatment = .
replace treatment = 0 if inlist(school_id,3,4,7,10,16,18,20,23,26,29,33,39,42,53,55,62,63,64,65,78,81,84,87,88,89,92,98,108,109,116,117,121)
replace treatment = 1 if inlist(school_id,15,19,22,27,32,36,37,40,49,51,56,57,58,61,66,68,72,76,79,82,83,86,91,95,100,102,103,106,110,114,125,126)
replace treatment = 2 if inlist(school_id,1,5,6,11,12,14,21,24,25,31,41,48,50,52,59,70,73,77,80,90,93,94,101,105,107,111,112,113,119,120,124)
replace treatment = 3 if inlist(school_id,2,8,9,13,17,28,30,34,35,38,43,44,45,46,47,54,60,67,69,71,74,75,85,96,97,99,104,115,118,122,123)

order municipality treatment, after(school_id)

lab var municipality "Municipality"
lab var treatment "Treatment group"

#delimit ;
;
label define treatment
0	"Control group"
1	"Door-to-door"
2	"Meetings"
3	"Both treatments"
;
label define municipality
1	"Sumbe"
2	"Porto Amboim"
3	"Gabela"
4	"Conda"
5	"Ebo"
6	"Quilenda"
7	"Seles"
8	"Cassongue"
9	"Quibala"
;
#delimit cr

lab val municipality municipality
lab val treatment treatment


replace date = 10 if school_id==39
replace month = 9 if school_id==39

replace date = 12 if school_id==60

replace date = 31 if school_id==114

drop r_date r_month

replace leader2_2 = 21 if school_id==69
replace leader2_1 = 11 if school_id==86
replace leader2_1 = 10 if school_id==106
replace leader2_1 = 32 if school_id==21
replace leader2_2 = 17 if school_id==71
replace leader2_2 = 3 if school_id==81

drop r_leader2_1 r_leader2_2

replace teacher_id = 1 if school_id== 67 & blue_id==5
replace teacher_id = 24 if school_id==2 & blue_id==1
replace teacher_id = 88 if school_id==23 & blue_id==2
replace teacher_id = 6 if school_id==26 & blue_id==4
replace teacher_id = 77 if school_id==29 & blue_id==4
replace teacher_id = 77 if school_id==35 & blue_id==4
replace teacher_id = 77 if school_id==124 & blue_id==3

replace teacher_name = "Zeferino Epalanga Nunda Catiavala" if school_id==56 & blue_id==2

replace teacher_id = 77 if school_id== 9 & blue_id==4

replace teacher_id = 88 if school_id== 53 & blue_id==4
replace teacher_id = 88 if school_id== 59 & blue_id==2
replace teacher_id = 88 if school_id== 60 & blue_id==1
replace teacher_id = 88 if school_id== 64 & blue_id==3
replace teacher_id = 88 if school_id== 66 & blue_id==1
replace teacher_id = 88 if school_id== 67 & blue_id==3
replace teacher_id = 12 if school_id== 88 & blue_id==3

replace teacher_id = 88 if school_id== 115 & blue_id==4

replace teacher_id = 88 if school_id== 49 & blue_id==3

********************************************************************************

// create old PGG form indicator

gen pgg_belief_old = 0

replace pgg_belief_old = 1 if inlist(school_id,10,32,35,62,64,65,74,79,84,	///
	89,90,97,112,116,118,122,124)

lab var pgg_belief_old "PGG: old belief form was used ('excluding' yourself)"


********************************************************************************

gen teacher_id2 = 100*school_id + teacher_id
gen teacher_id3 = 100*school_id + blue_id

lab var teacher_id2 "matching ID survey"
lab var teacher_id3 "matching ID network"

order teacher_id2 teacher_id3

sort teacher_id3


save "$Endline_dtRaw/_intermediate files/games_teachers.dta", replace


*** TEACHERS NETWORK ***

* Network Survey

use "$Endline_dtRaw/network/Teachers/Version 3/Questionrio de rede - Participantes AZUIS.dta", clear

append using "$Endline_dtRaw/network/Teachers/Version 4/Questionrio de rede - Participantes AZUIS.dta"

append using "$Endline_dtRaw/network/Teachers/Version 5/Questionrio de rede - Participantes AZUIS.dta"

append using "$Endline_dtRaw/network/Teachers/Version 6/blue.dta"

label drop _all

***********************

*delete teacher survey duplicates

drop if inlist(interview__key,"51-91-07-83","87-77-61-68","91-75-10-87","76-83-50-87","14-73-67-90","89-56-23-40","42-91-62-03")
drop if inlist(interview__key,"00-55-18-02","57-39-20-33","00-09-57-29","48-33-83-41","62-28-11-68","98-82-46-53")

*errors identified by hand

replace jogo_id_blue = 2 if interview__key == "77-78-35-21"
replace jogo_id_blue = 3 if interview__key == "37-48-19-99"
replace jogo_id_blue = 3 if interview__key == "38-58-47-19"
replace jogo_id_blue = 4 if interview__key == "24-77-26-50"
replace jogo_id_blue = 1 if interview__key == "80-65-57-14"
replace jogo_id_blue = 3 if interview__key == "75-55-26-40"
replace jogo_id_blue = 2 if interview__key == "98-69-09-69"

replace jogo_id_blue = 1 if interview__key == "82-66-60-35"
replace jogo_id_blue = 2 if interview__key == "86-29-03-45"
replace jogo_id_blue = 3 if interview__key == "74-87-13-25"
replace jogo_id_blue = 4 if interview__key == "50-13-44-45"

replace school_id = 74 if interview__key == "98-69-09-69"
replace school_id = 38 if interview__key == "38-29-68-42"
replace school_id = 38 if interview__key == "96-35-79-73"
replace school_id = 110 if interview__key == "40-63-29-68"
replace school_id = 110 if interview__key == "74-83-21-41"
replace school_id = 110 if interview__key == "12-56-40-96"
replace school_id = 110 if interview__key == "83-98-78-06"

gen phone = 0
replace phone = 1 if interview__key == "37-48-19-99"
replace phone = 1 if interview__key == "38-58-47-19"
replace phone = 1 if interview__key == "24-77-26-50"
replace phone = 1 if interview__key == "75-55-26-40"
replace phone = 1 if interview__key == "41-57-30-43"
replace phone = 1 if interview__key == "48-65-39-34"
replace phone = 1 if interview__key == "63-44-18-52"
replace phone = 1 if interview__key == "85-95-43-42"
replace phone = 1 if interview__key == "33-46-87-74"
replace phone = 1 if interview__key == "47-27-82-70"
replace phone = 1 if interview__key == "12-97-37-32"
replace phone = 1 if interview__key == "22-26-67-67"
replace phone = 1 if interview__key == "97-80-72-28"
replace phone = 1 if interview__key == "40-37-51-42"
replace phone = 1 if interview__key == "30-78-22-41"
replace phone = 1 if interview__key == "56-93-98-44"
replace phone = 1 if interview__key == "23-56-67-42"
replace phone = 1 if interview__key == "52-11-29-52"
replace phone = 1 if interview__key == "39-34-47-51"
replace phone = 1 if interview__key == "75-17-92-89"
replace phone = 1 if interview__key == "84-87-37-91"
replace phone = 1 if interview__key == "77-23-66-44"
replace phone = 1 if interview__key == "97-80-25-29"
replace phone = 1 if interview__key == "23-87-48-20"
replace phone = 1 if interview__key == "24-47-55-73"
replace phone = 1 if interview__key == "82-61-86-37"
replace phone = 1 if interview__key == "72-09-98-59"
replace phone = 1 if interview__key == "03-58-52-69"
replace phone = 1 if interview__key == "57-65-70-18"

gen teacher_id3 = 100*school_id + jogo_id_blue

order teacher_id3
sort teacher_id3

lab var teacher_id3 "matching ID network"
lab var phone "interviews completed over the phone"

rename (interview__key interview__id school_id jogo_id_blue teamleader interviewer date_time_start date_time_end sssys_irnd has__errors interview__status) (n_interview__key n_interview__id n_school_id n_jogo_id_blue n_teamleader n_interviewer n_date_time_start n_date_time_end n_sssys_irnd n_has__errors n_interview__status)

save "$Endline_dtRaw/_intermediate files/games_teachers_network.dta", replace


use "$Endline_dtRaw/_intermediate files/games_teachers.dta", clear


merge 1:1 teacher_id3 using "$Endline_dtRaw/_intermediate files/games_teachers_network.dta"

rename _merge merge_network

*************

save "$Endline_dtRaw/_intermediate files/games_teachers.dta", replace


** parents

use "$Endline_dtRaw/_intermediate files/games_register.dta", clear

reshape long name_parent id_parent game_id_parent, i(school_id) j(parent)


drop if game_id_parent==.

lab var parent "registration form sequence"

lab var name_parent 		"Name parent"
lab var id_parent 			"Questionnaire ID parent"
lab var game_id_parent		"Game ID parent"

keep school_id parent school_name date month leader1 leader2_1 leader2_2 name_parent id_parent game_id_parent

replace game_id_parent=3 if school_id==30 & id_parent==18
replace game_id_parent=10 if school_id==32 & id_parent==27
replace game_id_parent=9 if school_id==48 & id_parent==12

recode game_id_parent (6=9) (7=6) (8=7) (9=8) if school_id==79

gen id= (school_id*100)+game_id_parent

rename * r_*

rename r_id id


save "$Endline_dtRaw/_intermediate files/games_register_parents.dta", replace



use "$Endline_dtRaw/_intermediate files/games_parents.dta", clear

gen id= (school_id*100)+orange_id

merge 1:1 id using "$Endline_dtRaw/_intermediate files/games_register_parents.dta"

****** this should not be necessary anymore when all is solved:

keep if _merge==3

******

drop _merge

replace leader2_1 = . if leader2_1==88
replace leader2_2 = . if leader2_2==88

#delimit ;
;
label define enum
1	"Antonio Lopes Miguel Rocha"
2	"Augusta Júlio Miranda"
3	"César Zau Joaquim Morais Mendes"
4	"Edesdeth Abrantes Fonseca"
5	"Fernando Portugal Leonardo"
6	"Filipe Quissana Cariengue"
7	"Herlander Mauro Lemos Lima"
8	"Manuel Aguinaldo Barroso Moreira Francisco"
9	"Albertina de Oliveira Armando"
10	"Augusto Viana Kupinga"
11	"Beatriz Laurinda Teixeira da Costa"
12	"Carlos da Fonseca Ricardo "
13	"Carolina Germano da Silva"
14	"Felizarda Luis Avelino"
15	"Hermínia Caetano Kalolo"
16	"Ilídio Duarte Reis Cardoso"
17	"Isabel Marcolino Lisboa"
18	"João Monteiro Bimbe"
19	"José Alberto Nungulo Kamucunja"
20	"Manuel Pinheiro Inacio Ernesto"
21	"Marimilia Francisco Fernando"
22	"José Bambi Kandjeke"
23	"Samora Paulo José Ganga"
24	"Victória Maneco Tavares"
25	"Adelaide Fernando Miguens"
26	"Adelaide Marcelina da Cruz Zeferino"
27	"Adilson Fragoso Pascoal Inácio Filipe"
28	"Amaro Alberto Chipa"
29	"Ana Paula Silvestre Ventura"
30	"Antonio Calei Pedro da Silva"
31	"António Manuel da Silva"
32	"Bernardo Miguêns Gimbo"
33	"Bernardo Sungo Manuel Zau"
34	"Bráulio Eanes Gabriel Alberto"
35	"Bruno José Fernando Viegas"
36	"Carvalinho António Correia"
37	"Cirineu Jr. Jorge"
38	"Domingos Guimarães Sumano"
39	"Elvino António Sobral Salomão"
40	"Etelvina Albertina Francisco Teixeira"
41	"Helder Silvestre Lino Tomé Pinto"
42	"Joana Pinto Soma"
43	"Jonas Frederico Albino Rangel"
44	"José Catraio António"
45	"José Luciano Januário"
46	"José Maria Sumano Delgado"
47	"José Pinto Fançony"
48	"Magalhães Salissinga Gomes"
49	"Maria de Fátima Paulo Feliciano"
50	"Mariza Fernando Manuel Vales"
51	"Monteiro Bastos"
52	"Nilton Januário Valentim"
53	"Sara Claúdio Vidro Aguiar Maneco"
54	"Telma da Conceição Mweleyavo António"
55	"Teresa Aguiar da Costa"
56	"Teresa Kizua Kassucada"
57	"Bruno Avelino Segunda"
58	"Inocêncio Mário Cupenala"
59	"Sabino Jorge Bira"
;
label define version
1	"A: no reciprocity"
2	"B: representative decision"
3	"C: individual decision"
;
#delimit cr

lab val leader1 leader2_1 leader2_2 enum
lab val version version

foreach var in dgc_faces0 dgc_faces500 dgc_faces1000 dgc_faces1500 dgc_faces2000 dgc_belief0 dgc_belief500 dgc_belief1000 dgc_belief1500 dgc_belief2000{
replace `var'=. if version==2
}

replace dgb_faces0 = dgc_faces0 if version==3
replace dgb_faces500 = dgc_faces500 if version==3
replace dgb_faces1000 = dgc_faces1000 if version==3
replace dgb_faces1500 = dgc_faces1500 if version==3
replace dgb_faces2000 = dgc_faces2000 if version==3

replace dgb_belief0 = dgc_belief0 if version==3
replace dgb_belief500 = dgc_belief500 if version==3
replace dgb_belief1000 = dgc_belief1000 if version==3
replace dgb_belief1500 = dgc_belief1500 if version==3
replace dgb_belief2000 = dgc_belief2000 if version==3

rename dgb_* dg_*

drop dgc_faces0 dgc_faces500 dgc_faces1000 dgc_faces1500 dgc_faces2000 dgc_belief0 dgc_belief500 dgc_belief1000 dgc_belief1500 dgc_belief2000

lab var dg_faces0 			"DG: faces bought if received 0"
lab var dg_faces500 		"DG: faces bought if received 500"
lab var dg_faces1000 		"DG: faces bought if received 1000"
lab var dg_faces1500 		"DG: faces bought if received 1500"
lab var dg_faces2000 		"DG: faces bought if received 2000"
lab var dg_belief0 			"DG: belief about faces bought if received 0"
lab var dg_belief500 		"DG: belief about faces bought if received 500"
lab var dg_belief1000 		"DG: belief about faces bought if received 1000"
lab var dg_belief1500 		"DG: belief about faces bought if received 1500"
lab var dg_belief2000 		"DG: belief about faces bought if received 2000"

**pgg beliefs need to be corrected


drop id r_school_id r_parent r_leader1 r_game_id_parent

order r_school_name, after(school_id)
order r_name_parent r_id_parent, after(orange_id)

rename r_school_name school_name
rename r_name_parent parent_name
rename r_id_parent parent_id

order r_date r_month, after(month)
order r_leader2_1 r_leader2_2, after(leader2_2)

order blue orange, after(r_leader2_2)

replace date = r_date if school_id==39
replace month = r_month if school_id==39

replace date = r_date if school_id==60
replace month = r_month if school_id==60

replace date = r_date if school_id==114
replace month = r_month if school_id==114

drop r_date r_month

replace leader2_1 = 11 if school_id==86
replace leader2_1 = r_leader2_1 if school_id==92
replace leader2_1 = 21 if school_id==81

drop r_leader2_1

replace leader2_2 = 32 if school_id==21
replace leader2_2 = r_leader2_2 if school_id==69
replace leader2_2 = . if school_id==81
replace leader2_2 = r_leader2_2 if school_id==92

drop r_leader2_2

drop if orange_id==10 & school_id==112


replace orange = 8 if school_id==118
drop if school_id==118 & orange_id==9

***********

gen municipality = .
replace municipality = 1 if inlist(school_id,1,2,3,4,5,6,7,8,9,10,12,13,14,15,16,17,18,19,20,21,22,24,25,26,27,28,29,30,31,32,33,34,35,37,40,45,61,86,110)
replace municipality = 2 if inlist(school_id,23,43,44,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,62,63,64,65,66,67,68,69,70,71,72,73,75,76,77,78,79,80,81)
replace municipality = 3 if inlist(school_id,11,36,38,39,41,42,74,82,83,84,85,87,88,89,90,91,92,93,94,95,96,97,98,99,101,102,103,104,105)
replace municipality = 4 if inlist(school_id,118,119,120,121,122,123,124,125)
replace municipality = 5 if inlist(school_id,100,112,113,114,115,116,117)
replace municipality = 6 if inlist(school_id,109,111)
replace municipality = 7 if inlist(school_id,106,107)
replace municipality = 8 if inlist(school_id,126)
replace municipality = 9 if inlist(school_id,108)


gen treatment = .
replace treatment = 0 if inlist(school_id,3,4,7,10,16,18,20,23,26,29,33,39,42,53,55,62,63,64,65,78,81,84,87,88,89,92,98,108,109,116,117,121)
replace treatment = 1 if inlist(school_id,15,19,22,27,32,36,37,40,49,51,56,57,58,61,66,68,72,76,79,82,83,86,91,95,100,102,103,106,110,114,125,126)
replace treatment = 2 if inlist(school_id,1,5,6,11,12,14,21,24,25,31,41,48,50,52,59,70,73,77,80,90,93,94,101,105,107,111,112,113,119,120,124)
replace treatment = 3 if inlist(school_id,2,8,9,13,17,28,30,34,35,38,43,44,45,46,47,54,60,67,69,71,74,75,85,96,97,99,104,115,118,122,123)

gen t_1 = .
replace t_1 = 0 if treatment == 0
replace t_1 = 1 if treatment == 1
gen t_2 = .
replace t_2 = 0 if treatment == 0
replace t_2 = 1 if treatment == 2
gen t_3 = .
replace t_3 = 0 if treatment == 0
replace t_3 = 1 if treatment == 3
gen t_123 = .
replace t_123 = 0 if treatment == 0
replace t_123 = 1 if inlist(treatment,1,2,3)

order municipality treatment t_1 t_2 t_3 t_123, after(school_id)


lab var municipality "Municipality"
lab var treatment "Treatment group"

#delimit ;
;
label define treatment
0	"Control group"
1	"Door-to-door"
2	"Meetings"
3	"Both treatments"
;
label define municipality
1	"Sumbe"
2	"Porto Amboim"
3	"Gabela"
4	"Conda"
5	"Ebo"
6	"Quilenda"
7	"Seles"
8	"Cassongue"
9	"Quibala"
;
#delimit cr

lab val municipality municipality
lab val treatment treatment

replace leader2_1 = 10 if school_id==106
replace leader2_1 = 32 if school_id==21
replace leader2_2 = 17 if school_id==71
replace leader2_2 = 3 if school_id==81

replace parent_id=28 if school_id== 42 & orange_id==3
replace parent_id=9 if school_id== 42 & orange_id==7
replace parent_id=15 if school_id== 47 & orange_id==6
replace parent_id=8 if school_id== 53 & orange_id==10
replace parent_id=37 if school_id== 111 & orange_id==2
replace parent_id=. if school_id== 126 & orange_id==9
replace parent_id=13 if school_id== 7 & orange_id==4
replace parent_id=28 if school_id== 7 & orange_id==3
replace parent_id=23 if school_id== 7 & orange_id==1
replace parent_id=26 if school_id== 7 & orange_id==6
replace parent_id=29 if school_id== 37 & orange_id== 2
replace parent_id = 41 if school_id== 126 & orange_id==9
replace parent_id = 41 if school_id== 62 & orange_id==8
replace parent_id = 41 if school_id== 79 & orange_id==9
replace parent_id = 42 if school_id== 79 & orange_id==10
replace parent_id = 41 if school_id== 18 & orange_id==7
replace parent_id = 41 if school_id== 112 & orange_id==1
replace parent_id = 41 if school_id== 50 & orange_id==8
replace parent_id = 40 if school_id== 9 & orange_id==2
replace parent_id = 4 if school_id== 27 & orange_id==4
replace parent_id = 39 if school_id== 29 & orange_id==2
replace parent_id = 7 if school_id== 31 & orange_id==8
replace parent_id = 18 if school_id== 35 & orange_id==4
replace parent_id = 11 if school_id== 40 & orange_id==4
replace parent_id = 12 if school_id==48 & orange_id==6
replace parent_id = 10 if school_id==48 & orange_id==9
replace parent_id = 34 if school_id==50 & orange_id==5
replace parent_id = 40 if school_id==50 & orange_id==2
replace parent_id = 16 if school_id==54 & orange_id==7
replace parent_id = 1 if school_id==69 & orange_id==3
replace parent_id = 15 if school_id== 72 & orange_id==3
replace parent_id = 16  if school_id==74 & orange_id==5
replace parent_id = 40  if school_id==93 & orange_id==4
replace parent_id = 21 if school_id==98 & orange_id==2
replace parent_id = 15 if school_id==116 & orange_id==4
replace parent_id = 17 if school_id==118 & orange_id==7
replace parent_id = 41 if school_id==40 & orange_id==5
replace parent_id = 41 if school_id==64 & orange_id==8
replace parent_id = 20 if school_id==64 & orange_id==9

replace parent_name = "Amélia M. José" if school_id== 56 & orange_id==1
replace parent_name = "Teresa Manuel" if school_id== 23 & orange_id==9
replace parent_name = "Teresa Manuel" if school_id== 23 & orange_id==10
replace parent_name = "Julieta Jose" if school_id== 23 & orange_id==7
replace parent_name = "Eunice Benedito" if school_id== 39 & orange_id==6
replace parent_name = "Valentim Júlio" if school_id== 39 & orange_id==1
replace parent_name = "José Manuel Fernando" if school_id== 39 & orange_id==2
replace parent_name = "Eduardo Guilherme" if school_id== 39 & orange_id==10
replace parent_name = "Júlia Domingos" if school_id== 39 & orange_id==9
replace parent_name = "Armando Gabriel" if school_id== 39 & orange_id==7
replace parent_name = "Alfredo Martins" if school_id== 39 & orange_id==5
replace parent_name = "Gabriel Maurício Joaquim" if school_id== 39 & orange_id==3
replace parent_name = "Joaquim Maurício" if school_id== 39 & orange_id==4
replace parent_name = "Domingos Armando Jaime" if school_id== 39 & orange_id==8
replace parent_name = "Maria Salomão" if school_id== 56 & orange_id==6
replace parent_name = "Clementina Jeremias" if school_id== 100 & orange_id==6
replace parent_name = "Nani Virgílio" if school_id== 103 & orange_id==5

replace orange = 7 if school_id==18

********************************************************************************

// create old PGG form indicator

gen pgg_belief_old = 0

replace pgg_belief_old = 1 if inlist(school_id,64,70,84,90,97,122)

lab var pgg_belief_old "PGG: old belief form was used ('excluding' yourself)"

********************************************************************************


gen parent_id2 = 100*school_id + parent_id
gen parent_id3 = 100*school_id + orange_id

order parent_id2 parent_id3

lab var parent_id2 "matching ID"
lab var parent_id3 "matching ID network"

sort parent_id3


save "$Endline_dtRaw/_intermediate files/games_parents.dta", replace

*** PARENTS NETWORK ***

* Network Survey

use "$Endline_dtRaw/network/Parents/Version 3/Questionrio de rede - Participantes LARANJA.dta", clear

append using "$Endline_dtRaw/network/Parents/Version 4/Questionrio de rede - Participantes LARANJA.dta"

append using "$Endline_dtRaw/network/Parents/Version 5/Questionrio de rede - Participantes LARANJA.dta"

append using "$Endline_dtRaw/network/Parents/Version 6/orange.dta"

label drop _all

***********************

*delete parent survey duplicates

drop if inlist(interview__key,"01-93-34-16","78-81-62-15","59-12-47-84","58-46-63-37","21-56-01-48","71-23-00-19","53-21-52-04","15-93-89-34","87-22-62-04")
drop if inlist(interview__key,"14-10-35-39","51-35-85-77","85-77-68-13","02-11-06-37","56-66-78-02","27-51-23-61","58-19-74-73","33-29-13-67","31-49-50-81")


*errors identified by hand

replace jogo_id_orange = 1 if interview__key == "45-17-14-39"
replace jogo_id_orange = 2 if interview__key == "33-73-00-30"
replace jogo_id_orange = 3 if interview__key == "59-40-62-34"
replace jogo_id_orange = 4 if interview__key == "21-80-53-17"
replace jogo_id_orange = 5 if interview__key == "97-76-77-52"
replace jogo_id_orange = 6 if interview__key == "64-40-16-27"
replace jogo_id_orange = 9 if interview__key == "21-53-13-78"
replace jogo_id_orange = 6 if interview__key == "10-79-11-81"
replace jogo_id_orange = 6 if interview__key == "26-11-46-31"
replace jogo_id_orange = 7 if interview__key == "65-79-75-47"
replace jogo_id_orange = 3 if interview__key == "81-27-92-28"
replace jogo_id_orange = 2 if interview__key == "23-21-30-60"
replace jogo_id_orange = 3 if interview__key == "85-60-72-92"
replace jogo_id_orange = 4 if interview__key == "08-07-07-39"
replace jogo_id_orange = 5 if interview__key == "65-43-01-76"
replace jogo_id_orange = 6 if interview__key == "12-93-57-32"
replace jogo_id_orange = 7 if interview__key == "81-42-63-71"
replace jogo_id_orange = 8 if interview__key == "06-51-77-77"
replace jogo_id_orange = 9 if interview__key == "88-55-26-03"
replace jogo_id_orange = 10 if interview__key == "92-08-63-55"
replace jogo_id_orange = 2 if interview__key == "01-74-22-31"
replace jogo_id_orange = 9 if interview__key == "25-04-62-96"
replace jogo_id_orange = 8 if interview__key == "79-84-78-10"
replace jogo_id_orange = 5 if interview__key == "95-88-73-95"
replace jogo_id_orange = 6 if interview__key == "62-51-01-31"
replace jogo_id_orange = 8 if interview__key == "99-55-02-19"
replace jogo_id_orange = 4 if interview__key == "87-86-13-01"
replace jogo_id_orange = 7 if interview__key == "28-97-05-53"
replace jogo_id_orange = 8 if interview__key == "69-29-66-15"
replace jogo_id_orange = 3 if interview__key == "16-17-92-35"
replace jogo_id_orange = 5 if interview__key == "64-74-91-51"
replace jogo_id_orange = 3 if interview__key == "05-95-01-03"
replace jogo_id_orange = 6 if interview__key == "99-62-83-44"
replace jogo_id_orange = 7 if interview__key == "26-51-10-10"
replace jogo_id_orange = 8 if interview__key == "02-51-47-02"
replace jogo_id_orange = 9 if interview__key == "57-97-68-53"
replace jogo_id_orange = 1 if interview__key == "64-62-58-21"
replace jogo_id_orange = 6 if interview__key == "86-89-31-75"
replace jogo_id_orange = 10 if interview__key == "45-30-18-10"
replace jogo_id_orange = 3 if interview__key == "51-88-17-37"

replace school_id = 79 if interview__key == "86-89-31-75"
replace school_id = 2 if interview__key == "07-04-15-54"
replace school_id = 25 if interview__key == "80-62-99-64"
replace school_id = 25 if interview__key == "72-28-26-22"
replace school_id = 38 if interview__key == "30-67-88-10"
replace school_id = 54 if interview__key == "54-34-68-20"
replace school_id = 54 if interview__key == "41-62-66-51"
replace school_id = 60 if interview__key == "95-79-43-32"
replace school_id = 78 if interview__key == "67-11-43-43"
replace school_id = 78 if interview__key == "11-85-52-22"
replace school_id = 78 if interview__key == "08-38-77-97"
replace school_id = 99 if interview__key == "64-73-00-57"
replace school_id = 122 if interview__key == "70-96-15-43"

replace interviewer = 22 if interview__key == "41-12-65-25"

gen phone = 0
replace phone = 1 if interview__key == "98-31-09-82"
replace phone = 1 if interview__key == "81-83-96-33"
replace phone = 1 if interview__key == "65-24-99-19"
replace phone = 1 if interview__key == "30-27-05-19"
replace phone = 1 if interview__key == "36-04-45-33"
replace phone = 1 if interview__key == "30-83-75-61"
replace phone = 1 if interview__key == "90-52-00-98"
replace phone = 1 if interview__key == "26-11-46-31"
replace phone = 1 if interview__key == "11-74-40-84"
replace phone = 1 if interview__key == "57-90-80-21"
replace phone = 1 if interview__key == "92-14-63-59"
replace phone = 1 if interview__key == "31-51-40-50"
replace phone = 1 if interview__key == "78-36-08-33"
replace phone = 1 if interview__key == "68-88-62-04"
replace phone = 1 if interview__key == "62-94-29-15"
replace phone = 1 if interview__key == "85-60-59-71"
replace phone = 1 if interview__key == "21-67-37-15"
replace phone = 1 if interview__key == "10-22-79-99"
replace phone = 1 if interview__key == "15-48-94-89"
replace phone = 1 if interview__key == "59-11-25-29"
replace phone = 1 if interview__key == "43-92-09-20"
replace phone = 1 if interview__key == "18-44-70-78"

replace interview__key = "00-09-57-29" if interview__key=="80-62-99-64"
replace interview__key = "57-39-20-33" if interview__key=="72-28-26-22"

tostring sssys_irnd, replace force

foreach var in interview__id date_time_start O03_01 O03_02 O03_03 O03_04 O07_01 	///
 O07_02 sssys_irnd date_time_end{
		replace `var' = "" if inlist(interview__key,"00-09-57-29","57-39-20-33")
}

foreach var in O01	O02	O04_01	O04_02	O04_03	O04_04	O05	O06	O08_01		///
	O08_02	has__errors	interview__status{
		replace `var' = . if inlist(interview__key,"00-09-57-29","57-39-20-33")
}

replace interview__id		= "918c652636b54068ad7ca0eac4aa4460" 	if interview__key=="00-09-57-29"
replace date_time_start		= "2018-11-14T03:57:57" 	if interview__key=="00-09-57-29"
replace O01					= 1 	if interview__key=="00-09-57-29"
replace O02					= 4	if interview__key=="00-09-57-29"
replace O03_01				= "Augusta"	if interview__key=="00-09-57-29"
replace O04_01				= 2 	if interview__key=="00-09-57-29"
replace O03_02				= "Lusia" 	if interview__key=="00-09-57-29"
replace O04_02				= 2 	if interview__key=="00-09-57-29"
replace O03_03				= "Ana"	if interview__key=="00-09-57-29"
replace O04_03				= 2 	if interview__key=="00-09-57-29"
replace O03_04				= "Domingas" 	if interview__key=="00-09-57-29"
replace O04_04				= 3 	if interview__key=="00-09-57-29"
replace O05					= 1 	if interview__key=="00-09-57-29"
replace O06					= 2 if interview__key=="00-09-57-29"
replace O07_01				= "João" 	if interview__key=="00-09-57-29"
replace O08_01				= 1 	if interview__key=="00-09-57-29"
replace O07_02				= "André"	if interview__key=="00-09-57-29"
replace O08_02				= 1	if interview__key=="00-09-57-29"
replace date_time_end		= "2018-11-14T04:00:36" 	if interview__key=="00-09-57-29"
replace sssys_irnd			= "0.811393575655014" 	if interview__key=="00-09-57-29"
replace has__errors			= 0 	if interview__key=="00-09-57-29"
replace interview__status	= 100	if interview__key=="00-09-57-29"

replace interview__id		= "db252bb33a0545979d3e1d88a71b917f" 	if interview__key=="57-39-20-33"
replace date_time_start		= "2018-11-14T04:01:27" 	if interview__key=="57-39-20-33"
replace O01					= 1 	if interview__key=="57-39-20-33"
replace O02					= 2 	if interview__key=="57-39-20-33"
replace O03_01				= "Teresa Guiar" 	if interview__key=="57-39-20-33"
replace O04_01				= 1 	if interview__key=="57-39-20-33"
replace O03_02				= "Elias"	if interview__key=="57-39-20-33"
replace O04_02				= 1 	if interview__key=="57-39-20-33"
replace O05					= 1 	if interview__key=="57-39-20-33"
replace O06					= 2 	if interview__key=="57-39-20-33"
replace O07_01				= "Tina"	if interview__key=="57-39-20-33"
replace O08_01				= 1	if interview__key=="57-39-20-33"
replace O07_02				= "Nelito" 	if interview__key=="57-39-20-33"
replace O08_02				= 3	if interview__key=="57-39-20-33"
replace date_time_end		= "2018-11-14T04:04:18"	if interview__key=="57-39-20-33"
replace sssys_irnd			= "0.34778259664205"	if interview__key=="57-39-20-33"
replace has__errors			= 1 	if interview__key=="57-39-20-33"
replace interview__status	= 100	if interview__key=="57-39-20-33"

gen parent_id3 = 100*school_id + jogo_id_orange

order parent_id3
sort parent_id3

lab var parent_id3 "matching ID network"
lab var phone "interviews completed over the phone"

rename (interview__key interview__id school_id jogo_id_orange teamleader interviewer date_time_start date_time_end sssys_irnd has__errors interview__status) (n_interview__key n_interview__id n_school_id n_jogo_id_orange n_teamleader n_interviewer n_date_time_start n_date_time_end n_sssys_irnd n_has__errors n_interview__status)

save "$Endline_dtRaw/_intermediate files/games_parents_network.dta", replace


use "$Endline_dtRaw/_intermediate files/games_parents.dta", clear

merge 1:1 parent_id3 using "$Endline_dtRaw/_intermediate files/games_parents_network.dta"

rename _merge merge_network

replace orange = 10 if school_id==30
replace school_id = 30 if inlist(parent_id3,3009,3010)
replace municipality = 1 if inlist(parent_id3,3009,3010)
replace treatment = 3 if inlist(parent_id3,3009,3010)
replace school_name = "Cristo" if inlist(parent_id3,3009,3010)
replace parent_name = "not selected" if inlist(parent_id3,3009,3010)
replace orange_id = 9 if parent_id3==3009
replace orange_id = 10 if parent_id3==3010
replace parent_id = 41 if parent_id3==3009
replace parent_id = 42 if parent_id3==3010
replace date = 19 if inlist(parent_id3,3009,3010)
replace month = 7 if inlist(parent_id3,3009,3010)
replace parent_id2 = 3041 if parent_id3==3009
replace parent_id2 = 3042 if parent_id3==3010
replace merge_network = 3 if inlist(parent_id3,3009,3010)

gen mismatch = 0
replace mismatch = 1 if inlist(parent_id3,109,204,205,203,304,509,604,606,	///
	907,1004,1702,1708,2005,2406,2506,2505,2707,3008,3508,3506,3701,4306,	///
	4310,4406,5102,5601,5604,5806,5909,6703,6907,6908,7509,7507,7610,8004,	///
	8008,8006,8101,8106,8408,8509,8601,8602,8910,9505,9610,10109,10210,		///
	11904,12101,12110,12108,12104,12403,12402,12409)

lab var mismatch "different parent but correct household (compared with survey)"

drop if merge_network==2

*************

save "$Endline_dtRaw/_intermediate files/games_parents.dta", replace
